00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef DCATOMICFIELD_H
00020 #define DCATOMICFIELD_H
00021
00022 #include <cmath.h>
00023 #include "dcbase.h"
00024 #include "dcField.h"
00025 #include "dcSubatomicType.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034 class EXPCL_DIRECT DCAtomicField : public DCField {
00035 PUBLISHED:
00036 virtual DCAtomicField *as_atomic_field();
00037
00038 int get_num_elements() const;
00039 DCSubatomicType get_element_type(int n) const;
00040 string get_element_name(int n) const;
00041 int get_element_divisor(int n) const;
00042 string get_element_default(int n) const;
00043 bool has_element_default(int n) const;
00044
00045 bool is_required() const;
00046 bool is_broadcast() const;
00047 bool is_p2p() const;
00048 bool is_ram() const;
00049 bool is_db() const;
00050 bool is_clsend() const;
00051 bool is_clrecv() const;
00052 bool is_ownsend() const;
00053
00054 public:
00055 DCAtomicField();
00056 virtual void write(ostream &out, int indent_level = 0) const;
00057 virtual void generate_hash(HashGenerator &hash) const;
00058
00059 public:
00060
00061
00062 class ElementType {
00063 public:
00064 ElementType();
00065 bool set_default_value(double num);
00066 bool set_default_value(const string &str);
00067 bool set_default_value_literal(const string &str);
00068
00069 bool add_default_value(double num);
00070 bool add_default_value(const string &str);
00071 bool add_default_value_literal(const string &str);
00072 bool end_array();
00073
00074 DCSubatomicType _type;
00075 string _name;
00076 int _divisor;
00077 string _default_value;
00078 bool _has_default_value;
00079
00080 private:
00081 bool format_default_value(double num, string &formatted) const;
00082 bool format_default_value(const string &str, string &formatted) const;
00083 };
00084
00085 typedef pvector<ElementType> Elements;
00086 Elements _elements;
00087
00088 enum Flags {
00089 F_required = 0x0001,
00090 F_broadcast = 0x0002,
00091 F_p2p = 0x0004,
00092 F_ram = 0x0008,
00093 F_db = 0x0010,
00094 F_clsend = 0x0020,
00095 F_clrecv = 0x0040,
00096 F_ownsend = 0x0080,
00097 };
00098
00099 int _flags;
00100 };
00101
00102 #endif