summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Event/GPlot_File.h
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-19 00:37:14 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-19 00:37:14 +0000
commitde455ace388cc05a279d512a24398324ed1e0c28 (patch)
tree345d74d18354433b2d66c1f908f56edd42dd8628 /TAO/orbsvcs/orbsvcs/Event/GPlot_File.h
parent3e65d14268d4b7a05cbf355488483b307a6f45f1 (diff)
downloadATCD-de455ace388cc05a279d512a24398324ed1e0c28.tar.gz
ChangeLogTag:Wed Feb 18 17:56:54 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Event/GPlot_File.h')
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/GPlot_File.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/GPlot_File.h b/TAO/orbsvcs/orbsvcs/Event/GPlot_File.h
new file mode 100644
index 00000000000..278641244d2
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/Event/GPlot_File.h
@@ -0,0 +1,97 @@
+// $Id$
+//
+// ============================================================================
+//
+// = FILENAME
+// GPlot_File.h
+//
+// = AUTHOR
+// Tim Harrison
+//
+// ============================================================================
+
+#if !defined (ACE_GPlot_File_H)
+#define ACE_GPlot_File_H
+
+#include "ace/Map_Manager.h"
+#include "ace/Synch.h"
+
+class ACE_GPlot_File
+// = TITLE
+// Reads and writes files in GPlot format.
+//
+// = DESCRIPTION
+// Gplot formats are as follows:
+// entry value
+// entry value
+// entry value
+// ...
+// They represent x,y pairs to be graphed by GPlot. entry's are
+// type long. value's are type long or float.
+{
+public:
+ ACE_GPlot_File (void);
+ // Construction.
+
+ ~ACE_GPlot_File (void);
+ // Destruction. Calls this->close.
+
+ int open (const char *filename);
+ // If the file does not exist, create it. If the file exists open
+ // the file and read all the entries into map_. Returns 0 on
+ // success, -1 on failure.
+
+ void close (void);
+ // Close the file and sync all the contents.
+
+ int get (long entry, long &value);
+ // Get the entry at this value. Returns 0 if a value was found.
+ // Returns -1 if no value has been set for <entry>.
+
+ int get (long entry, float &value);
+ // Get the entry at this value. Returns 0 if a value was found.
+ // Returns -1 if no value has been set for <entry>.
+
+ void set (long entry, long value);
+ // Set the entry at this value.
+
+ void set (long entry, float value);
+ // Set the entry at this value.
+
+ void set_greatest (long entry, long value);
+ // Compare <value> with the value at <entry>. Store the largest.
+
+ void set_greatest (long entry, float value);
+ // Compare <value> with the value at <entry>. Store the largest.
+
+ void set_least (long entry, long value);
+ // Compare <value> with the value at <entry>. Store the smallest.
+
+ void set_least (long entry, float value);
+ // Compare <value> with the value at <entry>. Store the smallest.
+
+ void dump (void);
+ // Dump state of the object.
+
+private:
+ // = map_ stores all values. It is sync'ed to file when this->close
+ // is called.
+ typedef ACE_Map_Entry <long, char *> GPLOT_ENTRY;
+ typedef ACE_Map_Manager<long, char *, ACE_Null_Mutex> GPLOT_MAP;
+ typedef ACE_Map_Iterator <long, char *, ACE_Null_Mutex> GPLOT_ITERATOR;
+
+ GPLOT_MAP map_;
+
+ char filename_[BUFSIZ];
+ FILE *write_file_;
+
+ int closed_;
+ // Only close once.
+};
+
+#if defined (__ACE_INLINE__)
+#include "GPlot_File.i"
+#endif /* __ACE_INLINE__ */
+
+
+#endif /* ACE_GPlot_File_H */