00001 /* 00002 * (c) Onix Solutions. 00003 */ 00004 00005 #ifndef Group_h 00006 #define Group_h 00007 00008 #include <string> 00009 #include <iosfwd> 00010 00011 #include "FIXEngineDefines.h" 00012 #include "EngineException.h" 00013 00014 namespace FIXForge{ 00015 namespace FIX{ 00016 00017 class FF_API Message; 00018 00019 /// FIX Repeating Group. 00020 class FF_API Group{ 00021 public: 00022 /** 00023 * Returns 'true' if the message contains the field with the given tag, otherwise - 'false'. 00024 * 00025 * @param tag Tag number. 00026 * @param index Index of the repeating group instance. 00027 * 00028 * @return 'true' if the message contains the field with the given tag, otherwise - 'false'. 00029 */ 00030 bool contain(int tag, int index) const; 00031 00032 /** 00033 * Returns the field value as string. 00034 * 00035 * @param tag Tag number. 00036 * @param index Index of the repeating group instance. 00037 */ 00038 const std::string& get(int tag, int index); 00039 00040 /** 00041 * Returns the nested repeating group. 00042 * 00043 * @param numberOfInstancesTag Tag number of the field that defines the number of instances 00044 * in this repeating group (the NoXXX field). 00045 * 00046 * @param index Index of the repeating group instance. 00047 */ 00048 Group* getGroup(int numberOfInstancesTag, int index); 00049 00050 /** 00051 * Returns the field value as integer. 00052 * 00053 * @param tag Tag number. 00054 * @param index Index of the repeating group instance. 00055 * 00056 * @warning Return 0 if the field value is absent. 00057 */ 00058 int getInteger(int tag, int index) const; 00059 00060 /** 00061 * Returns the field value as a floating-point number. 00062 * 00063 * @param tag Tag number. 00064 * @param index Index of the repeating group instance. 00065 * 00066 * @warning Return 0 if the field value is absent. 00067 */ 00068 double getDouble(int tag, int index) const; 00069 00070 /// Return the number of instances in this repeating group. 00071 size_t numberOfInstances(); 00072 00073 /** 00074 * Removes the field. 00075 * 00076 * @param tag Tag number. 00077 * @param index Index of the repeating group instance. 00078 */ 00079 bool remove(int tag, int index); 00080 00081 /** 00082 * Returns 'true' if the given flag is present and it equals to "Y", otherwise 'false'. 00083 * 00084 * @param tag Tag number. 00085 * @param index Index of the repeating group instance. 00086 * 00087 * @return 'true' if the given flag is present and it equals to "Y", otherwise 'false'. 00088 */ 00089 bool hasFlag(int tag, int index) const; 00090 00091 /** 00092 * Sets the field value as string. 00093 * 00094 * @param tag Tag number. 00095 * @param index Index of the repeating group instance. 00096 * @param value Field value. 00097 */ 00098 bool set(int tag, int index, const std::string& value); 00099 00100 /** 00101 * Sets the field value as integer. 00102 * 00103 * @param tag Tag number. 00104 * @param index Index of the repeating group instance. 00105 * @param value Field value. 00106 */ 00107 bool set(int tag, int index, int value); 00108 00109 /** 00110 * Creates a new repeating group or changes the number of instances in the existing repeatign group. 00111 * 00112 * @param numberOfInstancesTag Tag number of the field that defines the number of instances in this repeating group (the NoXXX field). 00113 * @param index Index of the repeating group instance. 00114 * @param numberOfIntances Number of instances in the repeating group. 00115 */ 00116 Group* setGroup(int numberOfInstancesTag, int index, int numberOfIntances); 00117 00118 /** 00119 * Sets the given flag to "Y" or "N". 00120 * 00121 * @param tag Tag number. 00122 * @param index Index of the repeating group instance. 00123 * @param value Flag value. 00124 * 00125 * @return "true" if the flag had value before, otherwise "false" (the flag was inserted into the message). 00126 */ 00127 bool setFlag(int tag, int index, bool value); 00128 00129 /// Releases all Group resources (destroys the object). 00130 void release(); 00131 00132 private: 00133 /// Use Group::release() to free the resources instead of calling the destructor directly. 00134 ~Group(); 00135 00136 Group(void* native, const Message* msg); 00137 00138 friend class Message; 00139 00140 const Message* msg_; 00141 00142 struct Impl; 00143 Impl* impl_; 00144 }; 00145 }}; 00146 00147 #endif
1.5.2