69 void add_sandesh(std::string name,
t_sandesh* sandesh) {
70 sandeshs_[name] = sandesh;
73 t_sandesh* get_sandesh(std::string name) {
74 return sandeshs_[name];
80 throw "Enum " + name +
" is already defined!";
91 std::map<std::string, t_type*>::iterator iter;
92 for (iter =
types_.begin(); iter !=
types_.end(); ++iter) {
95 iter->second->get_name().c_str());
101 const std::map<t_const_value*, t_const_value*>& map = const_val->
get_map();
102 std::map<t_const_value*, t_const_value*>::const_iterator v_iter;
103 for (v_iter = map.begin(); v_iter != map.end(); ++v_iter) {
108 const std::vector<t_const_value*>& val = const_val->
get_list();
109 std::vector<t_const_value*>::const_iterator v_iter;
110 for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
115 const std::map<t_const_value*, t_const_value*>& map = const_val->
get_map();
116 std::map<t_const_value*, t_const_value*>::const_iterator v_iter;
117 for (v_iter = map.begin(); v_iter != map.end(); ++v_iter) {
120 throw "No field named \"" + v_iter->first->get_string() +
"\" was found in struct of type \"" + tstruct->
get_name() +
"\"";
129 if (constant == NULL) {
130 throw "No enum value or constant found named \"" + const_val->
get_identifier() +
"\"!";
152 throw "Constants cannot be of type VOID";
154 case t_base_type::TYPE_U16:
155 case t_base_type::TYPE_U32:
156 case t_base_type::TYPE_U64:
159 case t_base_type::TYPE_STATIC_CONST_STRING:
160 case t_base_type::TYPE_XML:
163 case t_base_type::TYPE_SANDESH_SYSTEM:
165 case t_base_type::TYPE_SANDESH_REQUEST:
167 case t_base_type::TYPE_SANDESH_RESPONSE:
169 case t_base_type::TYPE_SANDESH_TRACE:
171 case t_base_type::TYPE_SANDESH_TRACE_OBJECT:
173 case t_base_type::TYPE_SANDESH_BUFFER:
175 case t_base_type::TYPE_SANDESH_UVE:
177 case t_base_type::TYPE_SANDESH_DYNAMIC_UVE:
179 case t_base_type::TYPE_SANDESH_OBJECT:
181 case t_base_type::TYPE_SANDESH_FLOW:
183 case t_base_type::TYPE_SANDESH_SESSION:
187 }
else if (const_type->
is_map()) {
188 const std::map<t_const_value*, t_const_value*>& map = constant->
get_value()->
get_map();
189 std::map<t_const_value*, t_const_value*>::const_iterator v_iter;
192 for (v_iter = map.begin(); v_iter != map.end(); ++v_iter) {
193 const_val->
add_map(v_iter->first, v_iter->second);
195 }
else if (const_type->
is_list()) {
197 std::vector<t_const_value*>::const_iterator v_iter;
200 for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
210 if (enum_value == NULL) {
211 std::ostringstream valstm;
213 throw "Couldn't find a named value in enum " + tenum->
get_name() +
" for value " + valstm.str();
233 std::map<std::string, t_sandesh*> sandeshs_;
std::map< std::string, t_const * > constants_
t_service * get_service(std::string name)
void set_string(std::string val)
void add_type(std::string name, t_type *type)
void set_enum(t_enum *tenum)
void resolve_const_value(t_const_value *const_val, t_type *ttype)
virtual bool is_map() const
t_const * get_constant(std::string name)
t_field * get_field_by_name(std::string field_name)
virtual bool is_enum() const
t_type * get_type() const
virtual bool is_base_type() const
std::map< std::string, t_type * > types_
void set_integer(int64_t val)
const std::map< t_const_value *, t_const_value * > & get_map() const
const std::string & get_name()
void set_identifier(std::string val)
int64_t get_integer() const
t_const_value_type get_type() const
t_type * get_type() const
virtual bool is_set() const
t_enum_value * get_constant_by_value(int64_t value)
t_const_value * get_value() const
void set_double(double val)
void add_service(std::string name, t_service *service)
std::string get_identifier() const
virtual const std::string & get_name() const
virtual bool is_list() const
std::string get_string() const
void add_constant(std::string name, t_const *constant)
double get_double() const
std::map< std::string, t_service * > services_
virtual bool is_struct() const
void add_list(t_const_value *val)
void add_map(t_const_value *key, t_const_value *val)
t_type * get_type(std::string name)
const std::vector< t_const_value * > & get_list() const