diff --git a/src/trace/DrawTrace.hpp b/src/trace/DrawTrace.hpp index 317f5219c9a3ccaaddab6cf0e2d6204a4e05179f..4fd51f3570da61053658109218ad0788f3ca7e4b 100644 --- a/src/trace/DrawTrace.hpp +++ b/src/trace/DrawTrace.hpp @@ -241,18 +241,18 @@ public: i++) { state = *i; + map<std::string, Value *>::const_iterator field; // Search the color - extra_fields = state->get_value()->get_extra_fields(); - map<std::string, Value *>::const_iterator field = extra_fields->find(std::string("Color")); - if (field == extra_fields->end()) { - /* Call the object state drawing function with default color */ - draw_state(draw_object, state->get_start_time().get_value(), state->get_end_time().get_value(), position, 0.7, 0.7, 0.75); - } - else { + if (state->get_value() && + (field = state->get_value()->get_extra_fields()->find(std::string("Color"))) != extra_fields->end()) { /* Call the object state drawing function with the state color */ color = (const Color *)(*field).second; draw_state(draw_object, state->get_start_time().get_value(), state->get_end_time().get_value(), position, - color->get_red(), color->get_green(), color->get_blue()); + color->get_red(), color->get_green(), color->get_blue()); + } + else { + /* Call the object state drawing function with default color */ + draw_state(draw_object, state->get_start_time().get_value(), state->get_end_time().get_value(), position, 0.7, 0.7, 0.75); } }/* end for */ diff --git a/src/trace/Event.hpp b/src/trace/Event.hpp index e74c76bfc917ee3e3ad09cb1c7178b9d73e0b200..2b6076f8d13f54eb59314d40d6839068d452a7ec 100644 --- a/src/trace/Event.hpp +++ b/src/trace/Event.hpp @@ -48,6 +48,7 @@ public: /*! * \fn get_value() const * \brief Get the value of the event + * \return Pointer to the Entityvalue or NULL if it has no value */ const EntityValue *get_value() const; }; diff --git a/src/trace/Link.hpp b/src/trace/Link.hpp index 59fb2da10d4798b41e918bf65d7e318b1acbdfc2..3d2e230fd2ba7a378e6b65517c27ebf0151d1aff 100644 --- a/src/trace/Link.hpp +++ b/src/trace/Link.hpp @@ -57,6 +57,7 @@ public: /*! * \fn get_value() const * \brief Get the value of the link + * \return Pointer to the Entityvalue or NULL if it has no value */ const EntityValue *get_value() const; diff --git a/src/trace/State.hpp b/src/trace/State.hpp index 2500f09eed83113ad008e2fc61afd6e0bb7a3ce9..064ee00f72d4aeb7baed60369702cd15db062d16 100644 --- a/src/trace/State.hpp +++ b/src/trace/State.hpp @@ -56,6 +56,7 @@ public: /*! * \fn get_value() const * \brief Get the value of the state + * \return Pointer to the Entityvalue or NULL if it has no value */ const EntityValue *get_value() const; }; diff --git a/src/trace/Trace.cpp b/src/trace/Trace.cpp index 71f7083f95b893f2397e466211f03c13420481fe..f82745a826497c4580d8f8cd709af4f24055af47 100644 --- a/src/trace/Trace.cpp +++ b/src/trace/Trace.cpp @@ -95,7 +95,7 @@ void Trace::define_entity_value(Name &name, EntityType *entity_type, map<std::st } void Trace::set_state(Date &time, StateType *type, Container *container, EntityValue *value, map<std::string, Value *> &opt) { - if (container && type && value) + if (container && type) container->set_state(time, type, value); // Delete unused extra fields @@ -103,7 +103,7 @@ void Trace::set_state(Date &time, StateType *type, Container *container, EntityV } void Trace::push_state(Date &time, StateType *type, Container *container, EntityValue *value, map<std::string, Value *> &opt) { - if (container && type && value) + if (container && type) container->push_state(time, type, value); // Delete unused extra fields @@ -119,7 +119,7 @@ void Trace::pop_state(Date &time, StateType *type, Container *container, map<std } void Trace::new_event(Date &time, EventType *type, Container *container, EntityValue *value, map<std::string, Value *> &opt) { - if (container && type && value) + if (container && type) container->new_event(time, type, value); // Delete unused extra fields @@ -151,7 +151,7 @@ void Trace::sub_variable(Date &time, VariableType *type, Container *container, D } void Trace::start_link(Date &time, LinkType *type, Container *ancestor, Container *source, EntityValue *value, String key, map<std::string, Value *> &opt) { - if (ancestor && type && source && value) + if (ancestor && type && source) ancestor->start_link(time, type, source, value, key); // Delete unused extra fields @@ -159,7 +159,7 @@ void Trace::start_link(Date &time, LinkType *type, Container *ancestor, Containe } void Trace::end_link(Date &time, LinkType *type, Container *ancestor, Container *destination, EntityValue *value, String key, map<std::string, Value *> &opt) { - if (ancestor && type && destination && value) + if (ancestor && type && destination) ancestor->end_link(time, destination, key); // Delete unused extra fields