Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Tools/Xabsl2/GT/GTXabsl2Profiler/GTXabsl2ProfilerLog.h

Go to the documentation of this file.

    00001 #ifndef __GTXabsl2ProfilerLog_h_
    00002 #define __GTXabsl2ProfilerLog_h_
    00003
    00004 #ifdef _WIN32
    00005 #pragma warning(disable:4786)
    00006 // the constructor with all it's long parameter type names results in a too
    00007 // long debug identifier
    00008 #endif
    00009
    00010 #include <string>
    00011 #include <vector>
    00012 #include <deque>
    00013
    00014 #include "Platform/GTAssert.h"
    00015
    00016 #include "Tools/Streams/OutStreams.h"
    00017 #include "Platform/SystemCall.h"
    00018
    00019
    00020 #include "Tools/Xabsl2/Xabsl2Engine/Xabsl2Engine.h"
    00021 #include "Tools/Debugging/Debugging.h"
    00022
    00023 #include "Tools/Streams/InStreams.h"
    00024 #include "Tools/Module/SolutionRequest.h"
    00025
    00026 #include "GTXabsl2ProfilerNameTable.h"
    00027
    00028
    00029 class GTXabsl2ActiveOption{
    00030 public:
    00031   /** Number of the option. Index within the NameTable used for lookup */
    00032   int optionNumber;
    00033
    00034   /** Number of the state that is active within the option. Index within a NameTableEntry used for lookup */
    00035   int stateNumber;
    00036
    00037   /** Values for parameters of the option, where the position is the same as the names within a NametableEntry */
    00038   std::vector<double> parameters;
    00039
    00040   /*
    00041    *  Constructor
    00042    * Initialises to non-possible values
    00043    */
    00044   GTXabsl2ActiveOption(): optionNumber(-1), stateNumber(-1){}
    00045
    00046   /*
    00047    * Constructor
    00048    * Initialises to corresponding values
    00049    */
    00050   GTXabsl2ActiveOption(int o, int st, std::vector<double> p): optionNumber(o), stateNumber(st), parameters(p){}
    00051
    00052   /*
    00053    *  Equality operator. Based on memberwise comparison.
    00054    */
    00055   bool operator ==(const GTXabsl2ActiveOption other)const
    00056   {
    00057     if(this->optionNumber == other.optionNumber && this->stateNumber == other.stateNumber
    00058       && this->parameters == other.parameters)
    00059       return true;
    00060     return false;
    00061   }
    00062 };
    00063
    00064 /**
    00065 * @class GTXabsl2LogEntry
    00066 * Class for keeping numerical activation paths and framenumbers
    00067 * @author Michael Spranger
    00068 */
    00069 class GTXabsl2LogEntry{
    00070 public:
    00071   /** framenumber of the entry */
    00072   unsigned long frameNumber;
    00073
    00074   /** decimalinputsymbolvalues */
    00075   std::vector<double> inputSymbolValues;
    00076
    00077   /** activation path within XABSL-tree */
    00078   std::vector<GTXabsl2ActiveOption> activeOptions;
    00079
    00080   /*
    00081    *  Constructor
    00082    */
    00083   GTXabsl2LogEntry(){};
    00084   GTXabsl2LogEntry(unsigned long fn):frameNumber(fn){}
    00085   GTXabsl2LogEntry(unsigned long fn, std::vector<GTXabsl2ActiveOption> aO, std::vector<double>dI):frameNumber(fn), inputSymbolValues(dI), activeOptions(aO){}
    00086   unsigned int getMaxNumberOfParameters(){
    00087     unsigned int maxNumberOfParameters = 0;
    00088     for(unsigned int i = 0; i < activeOptions.size(); ++i){
    00089       if(activeOptions[i].parameters.size() > maxNumberOfParameters)
    00090         maxNumberOfParameters = activeOptions[i].parameters.size();
    00091     }
    00092     return maxNumberOfParameters;
    00093   }
    00094   int differsInParameters(GTXabsl2LogEntry& entry);
    00095 };
    00096 /**
    00097 * Streaming operator that reads KickCase from a stream.
    00098 * @param in The stream from which is read.
    00099 * @param log The log object.
    00100 * @return The stream.
    00101 */
    00102 In& operator>>(In& in, GTXabsl2LogEntry& log);
    00103
    00104 /**
    00105 * Streaming operator that writes KickCase to a stream.
    00106 * @param out The stream to write on.
    00107 * @param log The log object.
    00108 * @return The stream.
    00109 */
    00110 Out& operator<<(Out& out, const GTXabsl2LogEntry& log);
    00111
    00112 /*
    00113  * @class Class representing a log, including the nametable for XabslOptions, XablsStates, XabslOptionParameters and XabslInputSymbols
    00114  * @author Michael Spranger
    00115  */
    00116 class GTXabsl2Log: public std::deque<GTXabsl2LogEntry>
    00117 {
    00118 public:
    00119   /** NameTable for keeping corresponding names to numerical logs */
    00120   GTXabsl2ProfilerNameTable nameTable;
    00121
    00122   /** Names of the DecimalInputSymbols */
    00123   std::vector<std::string>   inputSymbolNames;
    00124
    00125   /** Maximal depth of the XABSL-Option-Tree */
    00126   //int maxDepth;
    00127
    00128   /** Constructor */
    00129   // GTXabsl2Log():maxDepth(0){}
    00130
    00131   /**
    00132    * Initialises the log for the a XabslEngine, creating NameTable and InputSymbolNameTable
    00133    */
    00134   void init(Xabsl2Engine& pEngine);
    00135
    00136   /**
    00137    * Appends a logentry to the current log
    00138    */
    00139   void append(GTXabsl2LogEntry logentry);
    00140
    00141   void clearAll();
    00142
    00143   int getIndexOfFrameNumber(unsigned int frameNumber);
    00144
    00145   int getActiveOptionNumberAtFrameNumber(unsigned int frameNumber, int optionMaxDepth);
    00146   GTXabsl2ActiveOption getOption(int index, int optionMaxDepth);
    00147 };
    00148
    00149 /**
    00150 * Streaming operator that reads KickCase from a stream.
    00151 * @param in The stream from which is read.
    00152 * @param log The log object.
    00153 * @return The stream.
    00154 */
    00155 In& operator>>(In& in, GTXabsl2Log& log);
    00156
    00157 /**
    00158 * Streaming operator that writes KickCase to a stream.
    00159 * @param out The stream to write on.
    00160 * @param log The log object.
    00161 * @return The stream.
    00162 */
    00163 Out& operator<<(Out& out, const GTXabsl2Log& log);
    00164
    00165
    00166 #endif// __GTXabsl2ProfilerLog_h_