Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Search  

/home/mrm/Simex/src/se_data.h

Go to the documentation of this file.
00001 #ifndef Se_Data_Included
00002 #define Se_Data_Included
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 #ifdef SIMEX_MASTER
00008 #include <gtk/gtk.h>
00009 #include <gdk/gdk.h>
00010 #endif
00011 
00012 #include "se_string.h"
00013 
00014 namespace Se{
00015 
00016 /*declarations*/
00017 class Object;
00018 
00019 class Data{
00020 
00021  public:
00022   
00023   enum Type{INT=0,
00024             FLOAT=1,
00025             DOUBLE=2};
00026   
00027   enum Mode{R=100,
00028             RW=101};
00029 
00030   enum Access{STEP=200,
00031               SIMULATION_STEP=201};
00032 
00033   enum Update{NO_UPDATE,
00034               UPDATE_FROM_VALUE,
00035               UPDATE_FROM_FORMULA};
00036   
00037  protected:
00038 
00039   //Data
00040   String name;
00041   Type type;
00042   Mode mode;
00043   Access access;
00044   int size;
00045   void *data;
00046 
00047   bool need_sending;
00048 
00049 #ifdef SIMEX_MASTER
00050   //Accumulation
00051   bool can_accumulate;
00052   bool accumulate;
00053   Data *accumulation_data;
00054 #endif
00055 
00056   //Matlab
00057 #ifdef SIMEX_MASTER
00058   String update_string;
00059   Update update_type;
00060   bool need_matlab_update;
00061 #endif
00062 
00063   //Interface
00064 #ifdef SIMEX_MASTER
00065   Object *parent;
00066 
00067   GtkWidget *name_entry;
00068   GtkWidget *size_entry;
00069   GtkWidget *data_widget;
00070   int old_size;
00071   GtkWidget *type_entry;
00072   GtkWidget *mode_entry;
00073   GtkWidget *access_entry;
00074   GtkWidget *data_table_window;
00075   GtkWidget *data_table_scrolled_window;
00076   GtkWidget *data_table;
00077   std::vector<GtkWidget *> data_table_names;
00078   std::vector<GtkWidget *> data_table_values;
00079   GtkWidget *accumulation_button;
00080 #endif
00081 
00082  public:
00083   
00084   //Constructors
00085   Data(String name,Type type,Mode mode,Access access);
00086 
00087   //Misc
00088   bool compare_name(String the_name);
00089   void clear();
00090   void set(void *,int);
00091   void add(void *);
00092   int get_size();
00093   void change_double_value(double d);
00094 
00095 #ifdef SIMEX_MASTER
00096   Data *get_accumulation_data();
00097   void accumulation();
00098 #endif
00099 
00100   //Matlab
00101 #ifdef SIMEX_MASTER
00102   void print_matlab_name();
00103   void set_parent(Object *the_parent);
00104   void update();
00105   void set_formula(String *the_formula);
00106   String get_matlab_name();
00107   void put_variable();
00108   void put_formula();
00109 #endif
00110 
00111   //Interface
00112 #ifdef SIMEX_MASTER
00113 
00114   guint get_x();
00115   guint get_y();
00116 
00117   void build(int x,int y,GtkTable *table);
00118   void build_data(int x,int y,GtkTable *table);
00119   void build_size(int x,int y,GtkTable *table);
00120   void build_name(int x,int y,GtkTable *table);
00121   void build_access(int x,int y,GtkTable *table);
00122   void build_type(int x,int y,GtkTable *table);
00123   void build_mode(int x,int y,GtkTable *table);
00124   void build_data_table();
00125   void build_accumulation(int x,int y, GtkTable *table);
00126 
00127   void rebuild();
00128   void rebuild_size();
00129   void rebuild_data();
00130   void rebuild_data_table();
00131 #endif
00132 
00133   //Callbacks
00134 #ifdef SIMEX_MASTER
00135   void accumulation_function();
00136 
00137   static void data_button_callback(GtkWidget *widget,gpointer data);
00138   static void accumulation_button_callback(GtkWidget *widget,gpointer data);
00139 #endif
00140 
00141   //Friends
00142   friend class Message;
00143   friend class Gtk_Message;
00144   friend class Data_Vector;
00145   friend class Gtk_Data_Vector;
00146   friend std::ostream& operator<< (std::ostream& s,
00147                                    const Data& the_data);
00148 };
00149 
00150 std::ostream& operator<< (std::ostream& s,
00151                    const Data& the_data);
00152 }
00153 #endif

Generated on Sat Jul 19 04:01:26 2003 for SIMEX by doxygen1.2.18