iop_vdevice.h
Go to the documentation of this file.
1 /** @file iop_vdevice.h Virtual device for interface definition */
2 
3 /*
4  FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2008, Thomas Moor
7  Exclusive copyright is granted to Klaus Schmidt
8 
9 */
10 
11 
12 
13 #ifndef FAUDES_VDEVICE_H
14 #define FAUDES_VDEVICE_H
15 
16 #include "corefaudes.h"
17 #include "tp_include.h"
18 #include "sp_densityfnct.h"
19 
20 
21 
22 // Note: iodevice debuggung uses direct console output since
23 // std redirection is not threadsafe.
24 
25 // Debugging: io level
26 #ifdef FAUDES_DEBUG_IODEVICE
27 #define FD_DH(message) FAUDES_WRITE_DIRECT("FAUDES_IODEVICE: " << message)
28 #else
29 #define FD_DH(message)
30 #endif
31 
32 
33 // Debugging: io level verbose
34 #ifdef FAUDES_DEBUG_IOVERBOSE
35 #define FD_DHV(message) FAUDES_WRITE_DIRECT("FAUDES_IODEVICE: " << message)
36 #else
37 #define FD_DHV(message)
38 #endif
39 
40 
41 // Debugging: io performance
42 #ifdef FAUDES_DEBUG_IOPERF
43 #define FD_DHT(message) FAUDES_WRITE_DIRECT("FAUDES_IOTIMING: " << message)
44 #else
45 #define FD_DHT(message)
46 #endif
47 
48 
49 // Max number of time stamps for performance monitor
50 #define FAUDES_DEBUG_IOPERF_SAMPLES 10000
51 
52 
53 
54 namespace faudes {
55 
56 
57 
58 /**
59  * Attribute for the configuration of a input or output mapping
60  *
61  * The base class for all device event attributes only distinguishes between
62  * output and input events. The actual attribute is of type AttributeVoid.
63  * Derived classes are meant to override this type in order to provide the
64  * defining data for the actual mapping of physical and logical events.
65  *
66  */
67 
69 
71 
72  public:
73 
74  /** Default constructor (no attributes, aka undefined) */
75 
77 
78  /** Copy constructor */
79  AttributeDeviceEvent(const AttributeDeviceEvent& rOtherAttr);
80 
81  /** Destructor */
82  virtual ~AttributeDeviceEvent(void);
83 
84  /** Clear */
85  virtual void Clear(void);
86 
87  /** Test for default value (undefined) */
88  virtual bool IsDefault(void) const {return (!mpOutputAttribute && !mpInputAttribute); };
89 
90  /** Does this attribute define an output mapping? */
91  bool IsOutput(void) const {return mpOutputAttribute!=0; };
92 
93  /** Does this attribute define a input mapping? */
94  bool IsInput(void) const {return mpInputAttribute!=0; };
95 
96  /** Set to default output attribute */
97  void DefaultOutput(void) {
98  Clear();
99  mpOutputAttribute= pOutputPrototype->New();
100  };
101 
102  /** Set to default input attribute */
103  void DefaultInput(void) {
104  Clear();
105  mpInputAttribute= pInputPrototype->New();
106  };
107 
108  /** Set output attribute */
109  virtual void Output(const AttributeVoid& rOutputAttribute) {
110  DefaultOutput();
111  mpOutputAttribute->Assign(rOutputAttribute);
112  };
113 
114  /** Set input attribute */
115  virtual void Input(const AttributeVoid& rInputAttribute) {
116  DefaultInput();
117  mpInputAttribute->Assign(rInputAttribute);
118  };
119 
120  /** Read output attribute */
121  virtual void ReadOutput(TokenReader& rTr) {
122  DefaultOutput();
123  mpOutputAttribute->Read(rTr);
124  };
125 
126  /** Read input attribute */
127  virtual void ReadInput(TokenReader& rTr) {
128  DefaultInput();
129  mpInputAttribute->Read(rTr);
130  };
131 
132  /** Get output mapping (return 0 if its not an output) */
133  const AttributeVoid* Outputp(void) const {return mpOutputAttribute; };
134 
135  /** Get input mapping (return 0 if its not a input) */
136  const AttributeVoid* Inputp(void) const {return mpInputAttribute; };
137 
138 
139 protected:
140 
141  /** Output Attribute (use cast in derived classes) */
143 
144  /** Input Attribute (use cast in derived classes) */
146 
147  /** Output Prototype (set to nontrivial attribute in derived classes) */
149 
150  /** Input Prototype (set to nontrivial attribute in derived classes) */
152 
153  /** Fallback attribute type (initialize on first use static construct)*/
154  static const AttributeVoid* FallbackAttributep(void);
155 
156  /**
157  * Assignment
158  *
159  * @param rSrcAttr
160  * Source to copy from
161  * @return
162  * Ref to this attribute
163  */
164  void DoAssign(const AttributeDeviceEvent& rSrcAttr);
165 
166 
167  /**
168  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
169  *
170  * If the current token indicates an "Input" or "Output" section, the method reads that
171  * section. Else it does nothing. Exceptions may only be thrown
172  * on invalid data within the section. The label argument is ignored.
173  * The context argument is ignored.
174  *
175  * @param rTr
176  * TokenReader to read from
177  * @param rLabel
178  * Section to read
179  * @param pContext
180  * Read context to provide contextual information
181  *
182  * @exception Exception
183  * - IO error (id 1)
184  */
185  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
186 
187  /**
188  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
189  *
190  * Writes all present device event attributes to include the defining data.
191  * The label argument is ignored, we use hardcoded labels "Input" or "Output".
192  * The context argument is ignored.
193  *
194  * @param rTw
195  * TokenWriter to write to
196  * @param rLabel
197  * Section to write
198  * @param pContext
199  * Read context to provide contextual information
200  *
201  * @exception Exception
202  * - IO error (id 2)
203  */
204  virtual void DoWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=0) const;
205 
206 
207 
208 }; // class AttributeDeviceEvent
209 
210 
211 
212 /**
213  * Virtual base class to define the interface for event io.
214  *
215  * @section IOPvdeviceA Input and Output event IO
216  *
217  * A vDevice provides an virtual interface to execute output events and sense
218  * input events, ie ReadInput() and WriteOutput(). The latter is prepared to
219  * be organized as a background thread that accumulates events in an internal fifo buffer.
220  * Once a input event has been read by the application, the buffer is cleared.
221  * A device is configured by passing an event set with device event attributes. The virtual
222  * base class formalls takes void attributes, and uses a dynamic cast to the actual attribute
223  * type that is provided by any derived class.
224  *
225  * @section IOPvdeviceB Physical Time
226  *
227  * The vDevice defines an interface to access the current physical time. The default
228  * implementation has msec resolution and is based on the system clock. Time may be queried
229  * in ms by CurrentTimeMs() or in faudes time unis (ftu) by CurrentTime(). Faudes time units
230  * refer to defining data in eg guards and invariants of timed automata or stochastical
231  * execution properties. Conversion to physical time is by the factor mTimeScale given in
232  * msecs per ftu. There is also a default implementation WaitInputs() for timed waiting
233  * for events based on condition variables.
234  * This requires a derived class to send the according signal. Both, physical
235  * time and waiting for events, may be overwritten in derived classes.
236  *
237  * @section IOPvdeviceC Operating Status
238  *
239  * The device may be in one of four operating states Down, StartUp, Up or ShutDown. Once configured
240  * you may Start() the device. The device will assychonously allocate required resources
241  * and if successful eventually be in state Up. While the device is Up, you can write
242  * outputs and read events. You can request the device to release resources by calling
243  * Stop(). While Up, you may also Reset() the device, to set outputs in passive state,
244  * to reset physical time to zero and tu flush the input fifo buffer.
245  *
246  * @section IOPvdeviceD File IO
247  *
248  * The vDevice provides std faudes token io interface via faudes::Type. In addition,
249  * there is a static constructor FromTokenreader() to construct a vDevice
250  * object of specific type as indentifiesd by the token section.
251  *
252  * @section Techical Note
253  *
254  * The vDevice derived classes implement std faudes type semantics for
255  * token IO plus the New() factory function to support type registration required for
256  * XML formated files. Assignment and comparison are, however, not implemented.
257  *
258  * @ingroup IODevicePlugin
259  */
260 
261 class FAUDES_API vDevice : public Type {
262 
263 
264  friend class xDevice;
265 
266 
267  public:
268 
269  /** Enum for device stages */
270  typedef enum { Down, StartUp, Up , ShutDown } DeviceState;
271 
272  /**
273  * Default constructor
274  */
275  vDevice(void);
276 
277  /**
278  * Construct on heap from token reader.
279  *
280  * This constructor examines the token strean, determines the coressponding
281  * class and constructs the device on the heap. Todo: the implementation
282  * of this function is a hack, there must be proper
283  * solution to this issue.
284  *
285  * @param rTr
286  * TokenReader to read from
287  * @return
288  * vDevice pointer
289  *
290  * @exception Exception
291  * - token mismatch (id 552)
292  * - IO errors (id 1)
293  */
294  static vDevice* FromTokenReader(TokenReader& rTr);
295 
296  /**
297  * Construct on heap from file.
298  *
299  * This constructor examines the file, determines the coressponding
300  * class and constructs the device on the heap.
301  *
302  * @param rFileName
303  * Filename
304  * @return
305  * vDevice pointer
306  *
307  * @exception Exception
308  * - token mismatch (id 552)
309  * - IO errors (id 1)
310  */
311  static vDevice* FromFile(const std::string& rFileName);
312 
313 
314  /**
315  * Explicit destructor.
316  */
317  virtual ~vDevice(void);
318 
319 
320  /**
321  * Set the device name
322  *
323  * @param rName
324  * Generator name
325  */
326  void Name(const std::string& rName);
327 
328  /**
329  * Get device name
330  *
331  * @return
332  * Name of generator
333  */
334  const std::string& Name(void) const;
335 
336 
337  /**
338  * Set tolerance for time synchonisation.
339  *
340  * @param maxgap
341  * Max acceptable amount of time by which the generator may be behind device time.
342  *
343  */
344  void Tolerance(Time::Type maxgap) {mMaxSyncGap=maxgap;};
345 
346 
347  /**
348  * Get tolerance.
349  *
350  * @return
351  * Max acceptable amount of time by which the generator may be behind device time
352  *
353  */
354  Time::Type Tolerance(void) {return mMaxSyncGap;};
355 
356 
357  /**
358  * Set timescale.
359  *
360  * @param scale
361  * Conversion factor in msecs/ftu (faudes time units)
362  *
363  */
364  virtual void TimeScale(unsigned int scale) {mTimeScale=scale; CurrentTime(0); };
365 
366 
367  /**
368  * Get timescale.
369  *
370  * @return
371  * Conversion factor in msecs/ftu (faudes time units)
372  *
373  */
374  virtual int TimeScale(void) {return mTimeScale;};
375 
376 
377  /**
378  * Clear all configuration.
379  * This implies Stop().
380  */
381  virtual void Clear(void);
382 
383  /**
384  * Insert/edit input or output configuration
385  *
386  * For a nontrivial device, a dynamic cast is used to
387  * access the attribute parameter.
388  *
389  * @param event
390  * Input or output event by faudes index
391  * @param attr
392  * Configuration attribute
393  * @exception Exception
394  * - unknown event (id 65)
395  * - Cannot cast attribute (id 550)
396  */
397  virtual void Configure(Idx event, const AttributeDeviceEvent& attr);
398 
399  /**
400  * Configure by alphabet
401  *
402  * For a nontrivial device, a dynamic cast is used to
403  * access atributes of the alphabet parameter.
404  *
405  * @param rPhysicalEvents
406  * Event set with configuration attributes
407  * @exception Exception
408  * - Cannot cast argument (id 550)
409  */
410  virtual void Configure(const EventSet& rPhysicalEvents);
411 
412 
413  /**
414  * Compile inner data-structures.
415  *
416  * As every derived class may have its own individual inner data-structures to
417  * set up, it has to reimplement its own Compile()-function if needed.
418  *
419  * In the base class Compile() builds up the input- and output event set.
420  *
421  */
422  virtual void Compile(void);
423 
424 
425  /**
426  * Get outputs as plain set.
427  *
428  * @return
429  * Set of all configured outputs
430  */
431  virtual const EventSet& Outputs(void) const;
432 
433  /**
434  * Get inputs as plain set.
435  *
436  * @return
437  * Set of all configured inputs
438  */
439  virtual const EventSet& Inputs(void) const;
440 
441 
442  /**
443  * Reset device. Resets any dynamic state such as edge detection.
444  * Since the vDevice only provides timing, it only resets the current faudes
445  * time to zero. A reset does not stop the device.
446  *
447  */
448  virtual void Reset(void);
449 
450  /**
451  * A device may ask for a reset by returning true for ResetRequest(). A well behaved
452  * simulator application will perform a Reset() and initialise any faudes::Executors,
453  * and stop the simulation. The device is meant to cancel any pending WaitInputs()
454  * or WaitInputsMs() when it requests a reset. The default implementation returns
455  * false;
456  *
457  * @return
458  * True, if a reset is requested
459  *
460  */
461  virtual bool ResetRequest(void);
462 
463  /**
464  * Activate the device. This function enables output execution and input reading.
465  * It will allocate device specific necessary resources eg start a background thread,
466  * initialise operating system device drivers etc.
467  *
468  * @exception Exception
469  * - Not yet configured (id 551)
470  */
471  virtual void Start(void);
472 
473  /**
474  * Deactivate the device. This function disables output execution and input reading.
475  * Stop also runs Reset.
476  *
477  */
478  virtual void Stop(void);
479 
480  /**
481  * Get status. This function returns the current status of the device.
482  * In derived classes that use background threads for input reading etc,
483  * a device may change its status without notice. Stop runs Reset()
484  *
485  */
486  virtual DeviceState Status(void) { return mState;};
487 
488  /**
489  * Get status as infromal string.
490  *
491  */
492  virtual std::string StatusString(void);
493 
494 
495  /**
496  * Run output command.
497  *
498  * @exception Exception
499  * - unknown output event (id 65)
500  *
501  */
502  virtual void WriteOutput(Idx output)=0;
503 
504  /**
505  * Flush pending IO Operations
506  *
507  * A device may implement buffered output operations, i.e. to assemble a process
508  * image befor applying it to the physical plant.
509  * By FlushOutputs() you can ask the device to execute all buffered
510  * output operations. FlushOutputs() is called by
511  * WaitInputs() and WaitInputsMs(), so buffers are automatically
512  * flushed when the simulation waits for input events.
513  * The default impelmentation of FlushOutputs() does nothing.
514  *
515  */
516  virtual void FlushOutputs(void);
517 
518  /**
519  * Read sensed input events.
520  * Report the oldest event from the internal input buffer.
521  * The event is removed from the buffer. The function returns
522  * 0 if the buffer is empty.
523  *
524  */
525  virtual Idx ReadInput(void);
526 
527  /**
528  * Peek for sensed events.
529  * Report the oldest input-event from the buffer. However,
530  * dont remove the event.
531  *
532  * @return
533  * Input-event index or 0 if no such available.
534  */
535  virtual Idx PeekInput(void);
536 
537 
538  /**
539  * Report whether a input-event is ready
540  */
541  virtual bool InputReady(void);
542 
543 
544  /**
545  * Wait for input trigger.
546  *
547  * The default implementation assumes that inputs events are
548  * notified via the condition signal. The duration to wait
549  * is specified in faudes time units (ftu) and is converted to system time
550  * by the scaling factor mTimeScale (ms/ftu).
551  *
552  * @return
553  * True, if events are available for read.
554  */
555  virtual bool WaitInputs(Time::Type duration);
556 
557  /**
558  * Wait for input trigger.
559  *
560  * Same as WaitInputs, but with the maximum time to wait given in
561  * msecs.
562  *
563  * @return
564  * True, if events are available for read.
565  */
566  virtual bool WaitInputsMs(long int duration);
567 
568 
569  /**
570  * Report physical time in ftu.
571  *
572  * The time elapsed since the last reset is retunred
573  * in faudes time units (ftu).
574  *
575  * @return
576  * Physical time.
577  */
578  virtual Time::Type CurrentTime(void);
579 
580  /**
581  * Report physical time in ms
582  *
583  * The time elapsed since the last reset is returned
584  * in msecs.
585  *
586  * @return
587  * Physical time.
588  */
589  virtual long int CurrentTimeMs(void);
590 
591  /**
592  * Set physical time in ftu.
593  * @param now
594  * physical time in faudes time units (ftu).
595  */
596  virtual void CurrentTime(Time::Type now);
597 
598 
599  /**
600  * Set physical time in ms.
601  * @param nowms
602  * physical time in msec
603  */
604  virtual void CurrentTimeMs(long int nowms);
605 
606 
607  /**
608  * Convert faudes time unit duration to system time
609  *
610  * Note: this helper function is not static since it refers to
611  * the parameter mTimeScale.
612  *
613  * @return
614  * Absolut system-time form now + duration in the future
615  * @param duration
616  * Time in faudes-time
617  */
618  virtual faudes_systime_t FtuToSystemTime(Time::Type duration);
619 
620  /** Tell the device which condition to use for waiting */
621  void UseCondition(faudes_mutex_t* wmutex, faudes_cond_t* wcond);
622 
623  /** Tell the device which buffer to use for inputs */
624  void UseBuffer(faudes_mutex_t* bmutex, std::deque<Idx>* bbuffer);
625 
626  /** Convenience method */
627  virtual std::string EStr(Idx ev) {return Inputs().Str(ev);};
628 
629  /** Get performance (need compiletime option) */
630  SampledDensityFunction Performance(void);
631 
632  /** Clear performance (need compiletime option) */
633  void ResetPerformance(void);
634 
635  /** Convenience method */
636  void WritePerformance(void);
637 
638  /**
639  * Stop all devices.
640  * This function is intended to be called on ungraceful termination of a
641  * simulater application. It uses a global variable that tracks all device
642  * instances.
643  *
644  */
645  static void StopAll(void);
646 
647  protected:
648 
649  /**
650  * Token output, see Type::Write for public wrappers.
651  * The vDevice inplements token writing to consist of DoWritePreface (device name and time scale).
652  * and DoWriteConfiguration (device specific event attributes). The default label is taken from the
653  * member variable mDefaultLabel. Derived classes are meant to set mDefaultLabel in their constructor
654  * and to reimplement DoWritePreface to add additional data eg cycle time or network address.
655  * The parameter pContext is ignored and passed on.
656  *
657  * @param rTw
658  * Reference to TokenWriter
659  * @param rLabel
660  * Label of section to write, defaults to name of set
661  * @param pContext
662  * Write context to provide contextual information
663  */
664  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
665 
666  /** Writes non-event-configuration data from TokenWriter
667  *
668  * This function is part of the non-event-configuration token-output mechanism. The vDevice will write
669  * its name and the time scale, derived classes are meant to first call the base class method and then
670  * add additional configuration parameter.
671  *
672  * Note: in order to keep the inputfile-layout as easy as possible no label will be used to separate
673  * this data-section. Never the less a default-label ("Device") is specified.
674  *
675  * @param rTw
676  * TokenWriter to write to
677  * @param rLabel
678  * Section to read
679  * @param pContext
680  * Provide contextual information
681  *
682  * */
683  virtual void DoWritePreface(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
684 
685 
686  /** Writes event-configuration to TokenWriter
687  *
688  * This function is part of the event-configuration token-output mechanism. It writes the device-specific
689  * event-configuration to provided TokenWriter. It uses the virtual interface of TBaseSet to figure the
690  * actual attribute type.
691  *
692  * Note: the event-configuration will be labeled by "EventConfiguration"
693  *
694  * @param rTw
695  * TokenWriter to write to
696  * @param rLabel
697  * Section to write
698  * @param pContext
699  * Provide contextual information
700  *
701  */
702  virtual void DoWriteConfiguration(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
703 
704  /**
705  * Token input, see Type::DRead for public wrappers.
706  * The vDevice implkements token input to consist of DoReadPreface (name, time scale etc) and DoReadConfiguration
707  * (events attributes), followed by Compile (set up internal data structures). The default label is given by
708  * the member variable mDefaultLabel. Derived classes arte meant to set mDefaultLabel in their constructor and
709  * to reimplement DoReadPreface to cover additional parameters. The pContext parameter is ignored.
710  *
711  * @param rTr
712  * Reference to TokenReader
713  * @param rLabel
714  * Label of section to write, defaults to name of set
715  * @param pContext
716  * Write context to provide contextual information
717  */
718  virtual void DoRead(TokenReader& rTr, const std::string& rLabel = "", const Type* pContext=0);
719 
720  /** Default label for token io */
721  std::string mDefaultLabel;
722 
723  /** Reads non-event-configuration data from TokenReader
724  *
725  * This function is part of the non-event-configuration token-input mechanism and located at the top
726  * of the class hierarchy. The vDevice will read its name and the time scale, derived classes are meant
727  * to first call the base class method and then read add additional configuration parameters.
728  *
729  * Note: in order to keep the inputfile-layout as easy as possible no label will be used to separate
730  * this data-section. Never the less a default-label ("Device") is specified.
731  *
732  * @param rTr
733  * TokenReader to write
734  * @param rLabel
735  * Section to read
736  * @param pContext
737  * Provide contextual information
738  *
739  */
740  virtual void DoReadPreface(TokenReader& rTr, const std::string& rLabel = "", const Type* pContext=0);
741 
742  /** Reads event-configuration data from TokenReader
743  *
744  * This function is part of the token-input mechanism and reads the device-specific event-configuration.
745  * It uses the virtual interface of TBaseSet to figure the actual attribute type. The section defaults to
746  * "EventConfiguration".
747  *
748  * @param rTr
749  * TokenReader to read
750  * @param rLabel
751  * Section to read
752  * @param pContext
753  Provide contextual information
754  * */
755  virtual void DoReadConfiguration(TokenReader& rTr, const std::string& rLabel = "", const Type* pContext=0);
756 
757  /** Name */
758  std::string mName;
759 
760  /** Overall event configuration (uses cast for type) */
762 
763  /** All inputs */
765 
766  /** All outputs */
768 
769  /** Status: running, starting etc */
771 
772  /** Default Wait Condition Mutex */
773  faudes_mutex_t mWaitMutex;
774 
775  /** Default Wait Condition */
776  faudes_cond_t mWaitCondition;
777 
778  /** Actual Wait Condition Mutex*/
779  faudes_mutex_t* pWaitMutex;
780 
781  /** Actual Wait Condition */
782  faudes_cond_t* pWaitCondition;
783 
784  /** physical timepoint zero */
785  faudes_systime_t mTimeZero;
786 
787  /** FauDES-time: scaling factor in ms/ftu */
789 
790  /** Toleance for time sync */
792 
793  /** Default Fifo buffer for input readings */
794  std::deque<Idx> mInputBuffer;
795 
796  /** Actual Fifo buffer for input readings */
797  std::deque<Idx>* pInputBuffer;
798 
799  /** Default mutex for input buffer (mutexted) */
800  faudes_mutex_t mBufferMutex;
801 
802  /** Actual mutex for input buffer (mutexted) */
803  faudes_mutex_t* pBufferMutex;
804 
805  /** Reset request marker (mutexed) */
807 
808  /**
809  * convert duration from fauDES-time units to ms
810  *
811  */
812  virtual long int FtuToMs(Time::Type faudes_time);
813 
814  /**
815  * convert duration in ms to faudes-time units
816  *
817  */
818  virtual Time::Type MsToFtu(long int real_time);
819 
820 
821 #ifdef FAUDES_DEBUG_IOPERF
822 
823  /** Filename for performance log */
824 #define FAUDES_DEBUG_IOPERF_LOG "tmp_ioperformance.txt"
825 
826  /** Structures to store time-samples in */
827  faudes_systime_t* mpPerformanceWaitEnter;
828  faudes_systime_t* mpPerformanceWaitExit;
829 
830  /** Global iterator */
833 
834 #endif
835 
836  private:
837 
838  // track all devices (initialize on first use construct)
839  static std::set<vDevice*>& AllDevices(void);
840 
841 }; // end class vDevice
842 
843 
844 
845 } // namespace faudes
846 
847 
848 #endif
849 
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
Attribute for the configuration of a input or output mapping.
Definition: iop_vdevice.h:68
const AttributeVoid * pOutputPrototype
Output Prototype (set to nontrivial attribute in derived classes)
Definition: iop_vdevice.h:148
void DefaultOutput(void)
Set to default output attribute.
Definition: iop_vdevice.h:97
const AttributeVoid * Outputp(void) const
Get output mapping (return 0 if its not an output)
Definition: iop_vdevice.h:133
const AttributeVoid * Inputp(void) const
Get input mapping (return 0 if its not a input)
Definition: iop_vdevice.h:136
virtual void Output(const AttributeVoid &rOutputAttribute)
Set output attribute.
Definition: iop_vdevice.h:109
virtual void Input(const AttributeVoid &rInputAttribute)
Set input attribute.
Definition: iop_vdevice.h:115
const AttributeVoid * pInputPrototype
Input Prototype (set to nontrivial attribute in derived classes)
Definition: iop_vdevice.h:151
virtual void ReadInput(TokenReader &rTr)
Read input attribute.
Definition: iop_vdevice.h:127
bool IsOutput(void) const
Does this attribute define an output mapping?
Definition: iop_vdevice.h:91
void DefaultInput(void)
Set to default input attribute.
Definition: iop_vdevice.h:103
AttributeVoid * mpInputAttribute
Input Attribute (use cast in derived classes)
Definition: iop_vdevice.h:145
AttributeVoid * mpOutputAttribute
Output Attribute (use cast in derived classes)
Definition: iop_vdevice.h:136
virtual bool IsDefault(void) const
Test for default value (undefined)
Definition: iop_vdevice.h:88
bool IsInput(void) const
Does this attribute define a input mapping?
Definition: iop_vdevice.h:94
virtual void ReadOutput(TokenReader &rTr)
Read output attribute.
Definition: iop_vdevice.h:121
Minimal Attribute.
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
Int Type
Datatype for point on time axis.
A TokenReader reads sequential tokens from a file or string.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
Virtual base class to define the interface for event io.
Definition: iop_vdevice.h:261
int mPerformanceBeginIterator
Definition: iop_vdevice.h:832
bool mResetRequest
Reset request marker (mutexed)
Definition: iop_vdevice.h:806
Time::Type mMaxSyncGap
Toleance for time sync.
Definition: iop_vdevice.h:791
int mTimeScale
FauDES-time: scaling factor in ms/ftu.
Definition: iop_vdevice.h:788
faudes_systime_t mTimeZero
physical timepoint zero
Definition: iop_vdevice.h:785
faudes_mutex_t * pBufferMutex
Actual mutex for input buffer (mutexted)
Definition: iop_vdevice.h:803
faudes_cond_t mWaitCondition
Default Wait Condition.
Definition: iop_vdevice.h:776
faudes_systime_t * mpPerformanceWaitEnter
Structures to store time-samples in.
Definition: iop_vdevice.h:827
std::string mDefaultLabel
Default label for token io.
Definition: iop_vdevice.h:721
faudes_cond_t * pWaitCondition
Actual Wait Condition.
Definition: iop_vdevice.h:782
virtual void TimeScale(unsigned int scale)
Set timescale.
Definition: iop_vdevice.h:364
faudes_mutex_t mWaitMutex
Default Wait Condition Mutex.
Definition: iop_vdevice.h:773
virtual std::string EStr(Idx ev)
Convenience method.
Definition: iop_vdevice.h:627
virtual DeviceState Status(void)
Get status.
Definition: iop_vdevice.h:486
EventSet * mpConfiguration
Overall event configuration (uses cast for type)
Definition: iop_vdevice.h:761
EventSet mInputs
All inputs.
Definition: iop_vdevice.h:764
EventSet mOutputs
All outputs.
Definition: iop_vdevice.h:767
virtual void WriteOutput(Idx output)=0
Run output command.
std::deque< Idx > mInputBuffer
Default Fifo buffer for input readings.
Definition: iop_vdevice.h:794
Time::Type Tolerance(void)
Get tolerance.
Definition: iop_vdevice.h:354
faudes_mutex_t * pWaitMutex
Actual Wait Condition Mutex.
Definition: iop_vdevice.h:779
std::string mName
Name.
Definition: iop_vdevice.h:758
std::deque< Idx > * pInputBuffer
Actual Fifo buffer for input readings.
Definition: iop_vdevice.h:797
DeviceState
Enum for device stages.
Definition: iop_vdevice.h:270
faudes_systime_t * mpPerformanceWaitExit
Definition: iop_vdevice.h:828
int mPerformanceEndIterator
Global iterator.
Definition: iop_vdevice.h:831
DeviceState mState
Status: running, starting etc.
Definition: iop_vdevice.h:770
void Tolerance(Time::Type maxgap)
Set tolerance for time synchonisation.
Definition: iop_vdevice.h:344
faudes_mutex_t mBufferMutex
Default mutex for input buffer (mutexted)
Definition: iop_vdevice.h:800
virtual int TimeScale(void)
Get timescale.
Definition: iop_vdevice.h:374
Container of devices.
Definition: iop_xdevice.h:49
Includes all libFAUDES headers, no plugins.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
Discrete density function approximation.
Include timed plugin headers.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen