- Timestamp:
- 05/23/12 16:56:18 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventImp.cc
r12128 r13830 122 122 //! fFunction) 123 123 // 124 EventImp::EventImp(const EventImp &cmd) : 125 fTargetState(cmd.fTargetState), fAllowedStates(cmd.fAllowedStates), 124 EventImp::EventImp(const EventImp &cmd) : fAllowedStates(cmd.fAllowedStates), 126 125 fFunction(cmd.fFunction) 127 126 { … … 242 241 for (unsigned int i=0; i<fAllowedStates.size(); i++) 243 242 out << " " << fAllowedStates[i]; 244 245 if (fTargetState<0)246 out << " (conf)";247 else248 out << " (trans->" << fTargetState << ")";249 243 250 244 const Time tm = GetTime(); … … 298 292 Print(cout, strip); 299 293 } 294 295 string EventImp::GetTimeAsStr(const char *fmt) const 296 { 297 return GetTime().GetAsStr(fmt); 298 } 299 300 uint64_t EventImp::GetJavaDate() const 301 { 302 return GetTime().JavaDate(); 303 } -
trunk/FACT++/src/EventImp.h
r12784 r13830 11 11 class EventImp 12 12 { 13 int fTargetState; /// Target state of an event14 13 std::vector<int> fAllowedStates; /// List of states in which this event is allowed 15 14 … … 19 18 public: 20 19 /// Constructor. Stores the target state given. 21 EventImp( int target=-1) : fTargetState(target) { }20 EventImp() { } 22 21 /// Copy constructor 23 22 EventImp(const EventImp &cmd); … … 29 28 30 29 // Function handling 31 EventImp &AssignFunction(const std::function<int(const EventImp &)> &func ) { fFunction = func; return *this; }30 EventImp &AssignFunction(const std::function<int(const EventImp &)> &func=std::function<int(const EventImp &)>()) { fFunction = func; return *this; } 32 31 bool HasFunc() const { return (bool)fFunction; } 33 32 int ExecFunc() const { return fFunction ? fFunction(*this) : -1; } … … 49 48 bool IsStateAllowed(int state) const; 50 49 51 int GetTargetState() const { return fTargetState; }52 53 50 // virtual function to return the data as stored in the derived classes 54 51 virtual std::string GetName() const { return ""; } … … 56 53 57 54 virtual const void *GetData() const { return 0; } 58 virtual intGetSize() const { return 0; }55 virtual size_t GetSize() const { return 0; } 59 56 60 57 virtual Time GetTime() const { return Time::None; } 58 virtual int GetQoS() const { return 0; } 59 60 std::string GetTimeAsStr(const char *fmt) const; 61 uint64_t GetJavaDate() const; 61 62 62 63 // Generalized access operators 63 64 template<typename T> 64 T Get( int offset=0) const65 T Get(size_t offset=0) const 65 66 { 66 67 if (offset>=GetSize()) … … 70 71 71 72 template<typename T> 72 const T *Ptr( int offset=0) const73 const T *Ptr(size_t offset=0) const 73 74 { 74 75 if (offset>=GetSize()) 75 76 throw std::logic_error("EventImp::Ptr - offset out of range."); 76 77 return reinterpret_cast<const T*>(GetText()+offset); 78 } 79 80 template<typename T> 81 const T &Ref(size_t offset=0) const 82 { 83 return *Ptr<T>(offset); 77 84 } 78 85
Note:
See TracChangeset
for help on using the changeset viewer.