diff --git a/parser/src/Definition.cpp b/parser/src/Definition.cpp index a82009e1b6e8cc91805a52db7dede4b81e25af93..7fc0d88d0ebf3c016d8ff5507dfa675d80c73a44 100644 --- a/parser/src/Definition.cpp +++ b/parser/src/Definition.cpp @@ -36,3 +36,315 @@ const vector<field> &Definition::get_fields() const{ string Definition::get_event_name() const{ return _event_name; } + +bool Definition::check_definition() const{ + const int number_of_fields = _fields.size(); + + // Name - string or integer + // ContainerType - string or integer + // Alias - string or integer + if(_event_name == "PajeDefineContainerType" || _event_name == "PajeDefineEventType" || _event_name == "PajeDefineStateType" || _event_name == "PajeDefineVariableType"){ + bool has_name_or_alias = false; + bool has_container_type = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if((_fields[i]._name == "Name" || _fields[i]._name == "Alias") && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_name_or_alias = true; + } + // We check if we have the ContainerType + else if(_fields[i]._name == "ContainerType" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_container_type = true; + } + // We return true if we have the compulsory fields and we don't care of others + if(has_name_or_alias && has_container_type){ + return true; + } + } + } + // Time - date, Name - string or integer, Type - string or integer, + // Container - string or integer, Alias - string or integer + else if(_event_name == "PajeCreateContainer"){ + bool has_name_or_alias = false; + bool has_time = false; + bool has_type = false; + bool has_container = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if((_fields[i]._name == "Name" || _fields[i]._name == "Alias") && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_name_or_alias = true; + } + // We check if we have the container + else if(_fields[i]._name == "Container" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){ + has_container = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){ + has_type = true; + } + // We return true if we have the compulsory fields and we don't care of others + if(has_name_or_alias && has_container && has_time && has_type){ + return true; + } + } + } + // Time - date, Name - string or integer + // Type - string or integer + else if(_event_name == "PajeDestroyContainer"){ + bool has_name_or_alias = false; + bool has_time = false; + bool has_type = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if((_fields[i]._name == "Name" || _fields[i]._name == "Alias") && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_name_or_alias = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){ + has_type = true; + } + // We return true if we have the compulsory fields and we don't care of others + if(has_name_or_alias && has_time && has_type){ + return true; + } + } + } + // Name - string or integer, ContainerType - string or integer + // SourceContainerType - string or integer, DestContainerType - string or integer + // Alias - string or integer + else if(_event_name == "PajeDefineLinkType"){ + bool has_name_or_alias = false; + bool has_ContainerType = false; + bool has_SourceContainerType = false; + bool has_DestContainerType = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if((_fields[i]._name == "Name" || _fields[i]._name == "Alias") && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_name_or_alias = true; + } + // We check if we have the ContainerType + else if(_fields[i]._name == "ContainerType" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_ContainerType = true; + } + // We check if we have the SourceContainerType + else if(_fields[i]._name == "SourceContainerType" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_SourceContainerType = true; + } + // We check if we have the DestContainerType + else if(_fields[i]._name == "DestContainerType" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_DestContainerType = true; + } + // We return true if we have the compulsory fields and we don't care of others + if(has_name_or_alias && has_ContainerType && has_SourceContainerType && has_DestContainerType){ + return true; + } + } + } + // Name - string or integer, EntityType - string or integer, Alias - string or integer + else if(_event_name == "PajeDefineEntityValue"){ + bool has_name_or_alias = false; + bool has_EntityType = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if((_fields[i]._name == "Name" || _fields[i]._name == "Alias") && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_name_or_alias = true; + } + // We check if we have the time + else if(_fields[i]._name == "EntityType" && (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_EntityType = true; + } + // We return true if we have the compulsory fields and we don't care of others + if(has_name_or_alias && has_EntityType){ + return true; + } + } + } + // Time - date, Type - string or integer, Container - string or integer, Value - string or integer + else if(_event_name == "PajeSetState" || _event_name == "PajePushState" || + _event_name == "PajeNewEvent"){ + bool has_Container = false; + bool has_time = false; + bool has_Value = false; + bool has_type = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if(_fields[i]._name == "Container" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Container = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){ + has_type = true; + } + // We check if we have the value + else if(_fields[i]._name == "Value" && (_fields[i]._type == "string" || _fields[i]._type == "integer")){ + has_Value = true; + } // We return true if we have the compulsory fields and we don't care of others + if(has_Container && has_time && has_type && has_Value){ + return true; + } + } + } + // Time - date, Type - string or integer, Container - string or integer + else if(_event_name == "PajePopState"){ + bool has_Container = false; + bool has_time = false; + bool has_type = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the time + if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_type = true; + } + // We check if we have the value + else if(_fields[i]._name == "Container" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Container = true; + } // We return true if we have the compulsory fields and we don't care of others + if(has_Container && has_time && has_type){ + return true; + } + } + } + // Time - date, Type - string or integer, Container - string or integer, Value - double + else if(_event_name == "PajeSetVariable" || _event_name == "PajeAddVariable" || + _event_name == "PajeSubVariable"){ + bool has_Container = false; + bool has_time = false; + bool has_Value = false; + bool has_type = false; + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if(_fields[i]._name == "Container" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Container = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_type = true; + } + // We check if we have the value + else if(_fields[i]._name == "Value" && _fields[i]._type == "double"){ + has_Value = true; + } // We return true if we have the compulsory fields and we don't care of others + if(has_Container && has_time && has_type && has_Value){ + return true; + } + } + } + // Container - string or integer, Time - date, Type - string or integer + // SourceContainer - string or integer, Value - string or integer, Key - string or integer + else if(_event_name == "PajeStartLink"){ + bool has_Container = false; + bool has_time = false; + bool has_type = false; + bool has_Value = false; + bool has_key = false; + bool has_SourceContainer = false; + + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if(_fields[i]._name == "Container" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Container = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_type = true; + } + // We check if we have the key + else if(_fields[i]._name == "Key" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_key = true; + } + // We check if we have the SourceContainer + else if(_fields[i]._name == "SourceContainer" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_SourceContainer = true; + } + // We check if we have the value + else if(_fields[i]._name == "Value" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Value = true; + } // We return true if we have the compulsory fields and we don't care of others + if(has_Container && has_time && has_type && has_Value && has_key && has_SourceContainer){ + return true; + } + } + } + // Container - string or integer, Time - date, Type - string or integer + // DestContainer - string or integer, Value - string or integer, Key - string or integer + else if(_event_name == "PajeEndLink"){ + bool has_Container = false; + bool has_time = false; + bool has_type = false; + bool has_Value = false; + bool has_key = false; + bool has_DestContainer = false; + + for(int i = 0 ; i < number_of_fields ; i ++){ + // We check if we have the name or the alias + if(_fields[i]._name == "Container" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Container = true; + } + // We check if we have the time + else if(_fields[i]._name == "Time" && _fields[i]._type == "date"){ + has_time = true; + } + // We check if we have the type + else if(_fields[i]._name == "Type" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_type = true; + } + // We check if we have the key + else if(_fields[i]._name == "Key" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_key = true; + } + // We check if we have the SourceContainer + else if(_fields[i]._name == "DestContainer" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_DestContainer = true; + } + // We check if we have the value + else if(_fields[i]._name == "Value" && + (_fields[i]._type == "string" || _fields[i]._type == "integer" || _fields[i]._type == "int")){ + has_Value = true; + } // We return true if we have the compulsory fields and we don't care of others + if(has_Container && has_time && has_type && has_Value && has_key && has_DestContainer){ + return true; + } + } + } + else{ + cerr << "Unknown type" << endl; + return false; + } + return false; +} diff --git a/parser/src/Definition.hpp b/parser/src/Definition.hpp index 6b41c743bde1506b48e4499b90c2877c2cfd9b12..3c0c23e782ca1e878a3355193829931aa584e379 100644 --- a/parser/src/Definition.hpp +++ b/parser/src/Definition.hpp @@ -1,15 +1,14 @@ #ifndef DEFINITION_HPP #define DEFINITION_HPP -#include <vector> -#include <iostream> - - /*! \class Definition Definition.hpp "../parser/src/Definition.hpp" * Contains the definition of a definition. */ + +#include <vector> +#include <iostream> #include <string> @@ -53,7 +52,7 @@ public: * \param name : the name of the event * \param value : the type of the event */ - void store(std::string name,std::string value); + void store(std::string name, std::string value); @@ -76,6 +75,12 @@ public: * */ std::string get_event_name() const; + + /*! \fn check_definition + * \brief Check if the definition stored is correct. + * \return true if the definition is correct. + */ + bool check_definition() const; }; #endif // DEFINITION_HPP diff --git a/parser/src/ParserDefinitionDecoder.cpp b/parser/src/ParserDefinitionDecoder.cpp index 0a5d9dd08ec5a36312e80098d1040937945d65b2..c5b06426a426bef43da670dfc6008184053fa471 100644 --- a/parser/src/ParserDefinitionDecoder.cpp +++ b/parser/src/ParserDefinitionDecoder.cpp @@ -23,59 +23,50 @@ int ParserDefinitionDecoder::definitions_number(){ void ParserDefinitionDecoder::enter_definition(Line &line){ - DIE_IF(_state == IN_A_DEFINITION,"expected %EndDef"); + DIE_IF(_state == IN_A_DEFINITION, "expected %EndEventDef"); string definition_name; - DIE_IF(!line.item(2,definition_name),"a definition has no name"); + DIE_IF(!line.item(2, definition_name), "a definition has no name"); int definition_identity; string definition_identity_string; - DIE_IF(!line.item(3,definition_identity_string),"definition has no identifier"); - DIE_IF(sscanf(definition_identity_string.c_str(),"%d",&definition_identity)!=1,"expected identifier for a definition"); + DIE_IF(!line.item(3, definition_identity_string), "definition has no identifier"); + DIE_IF(sscanf(definition_identity_string.c_str(), "%d", &definition_identity) != 1, "expected identifier for a definition"); Definition current_definition = Definition(definition_name); _definitions.insert(pair<int,Definition>(definition_identity, current_definition)); _current_definition = definition_identity; - WARN_IF((line.length()>4),"warning extra token in %EvenDef"); + WARN_IF((line.length() > 4), "warning extra token in %EventDef"); _state = IN_A_DEFINITION; return; } void ParserDefinitionDecoder::leave_definition(Line&line){ - - - DIE_IF(_state != IN_A_DEFINITION,"expected %EventDef"); - - - _state = OUT_A_DEFINITION; - - - WARN_IF((line.length()>2),"warning extra token in %EvenDef"); - - - + + DIE_IF(_state != IN_A_DEFINITION, "expected %EventDef"); + + _state = OUT_A_DEFINITION; + + WARN_IF((line.length() > 2), "warning extra token in %EventDef"); + } void ParserDefinitionDecoder::add_field_to_definition(std::string& first_token,Line& line){ - DIE_IF(_state == OUT_A_DEFINITION,"expected %EventDef2"); + DIE_IF(_state == OUT_A_DEFINITION, "expected %EventDef2"); string field_value; - DIE_IF(!line.item(2,field_value),"A field type is missing."); - - _definitions[_current_definition].store(first_token,field_value); + DIE_IF(!line.item(2, field_value), "A field type is missing."); + _definitions[_current_definition].store(first_token, field_value); } void ParserDefinitionDecoder::store_definition(Line &line){ - - string first_token; - DIE_IF(!line.item(1,first_token),"error : a definition line is empty"); + DIE_IF(!line.item(1,first_token), "error : a definition line is empty"); - if (first_token == "EventDef"){ enter_definition(line); } diff --git a/parser/src/ParserEventDecoder.hpp b/parser/src/ParserEventDecoder.hpp index 870d3299736f1b12320e7ea4b024c58940e678b1..5a59576cd72b9bed05798f4aa450ca836db697e2 100644 --- a/parser/src/ParserEventDecoder.hpp +++ b/parser/src/ParserEventDecoder.hpp @@ -5,13 +5,13 @@ #include <map> #include "Definition.hpp" #include "Line.hpp" -#include "../../values/color.hpp" -#include "../../values/date.hpp" -#include "../../values/double.hpp" -#include "../../values/hex.hpp" -#include "../../values/integer.hpp" -#include "../../values/name.hpp" -#include "../../values/string.hpp" +#include "../../trace/src/values/Color.hpp" +#include "../../trace/src/values/Date.hpp" +#include "../../trace/src/values/Double.hpp" +#include "../../trace/src/values/Hex.hpp" +#include "../../trace/src/values/Integer.hpp" +#include "../../trace/src/values/Name.hpp" +#include "../../trace/src/values/String.hpp" #include "../../trace/src/Trace.hpp" /** diff --git a/parser/src/ParserPaje.cpp b/parser/src/ParserPaje.cpp index 2c98b46df25d2c477ea1149fe121cd3e63ecb5d8..73705d5c29649a43fe0b829f439e1b16e5662faa 100644 --- a/parser/src/ParserPaje.cpp +++ b/parser/src/ParserPaje.cpp @@ -27,5 +27,5 @@ void ParserPaje::parse(string filename, Trace &trace){ } } - + delete parser_event_decoder; } diff --git a/trace/src/Container.hpp b/trace/src/Container.hpp index 197a2c04defc534d46969689907dcb47e18dd4a5..c79fa422e94cfc80c01078bab1db15fc98bdef05 100644 --- a/trace/src/Container.hpp +++ b/trace/src/Container.hpp @@ -1,35 +1,35 @@ -#ifndef CONTAINER_HPP -#define CONTAINER_HPP - -/*! - * - * \file container.hpp - * \author Clément Vuchener - * \brief Contains the definition of the class Container - * \date 2009 January 30th - * - */ +#ifndef CONTAINER_HPP +#define CONTAINER_HPP + +/*! + * + * \file container.hpp + * \author Clément Vuchener + * \brief Contains the definition of the class Container + * \date 2009 January 30th + * + */ #include <list> using std::list; - -#include "values/Name.hpp" -#include "values/Date.hpp" - -#include "ContainerType.hpp" + +#include "values/Name.hpp" +#include "values/Date.hpp" + +#include "ContainerType.hpp" class Container; -#include "State.hpp" -#include "EntityList.hpp" - - -/*! - * - * \class Container - * \brief contains others containers or entities - * - */ +#include "State.hpp" +#include "EntityList.hpp" + + +/*! + * + * \class Container + * \brief contains others containers or entities + * + */ class Container { friend class State; private: @@ -39,77 +39,77 @@ private: Container *_parent; list<Container *> _children; EntityList _states; - -public: - Container(Name &name, Date &creation_time, ContainerType *type, Container *parent); + +public: + Container(Name &name, Date &creation_time, ContainerType *type, Container *parent); ~Container(); - - /*! - * - * \fn get_name - * \brief Returns the name and the alias of the container - * - */ - const Name &get_name() const; - - /*! - * - * \fn get_parent - * \brief Returns the parent container - * - */ - const Container *get_parent() const; - - /*! - * - * \fn get_type - * \brief Returns the type of the container - * - */ - const ContainerType *get_type() const; - - /*! - * - * \fn get_children - * \brief Returns the list of the child containers - * - */ - const list<Container *> &get_children() const; - - /*! - * - * \fn get_creation_time - * \brief Returns the time when the container was created - * - */ - const Date &get_creation_time() const; - - /*! - * - * \fn get_destruction_time - * \brief Returns the time when the container was destroyed - * - */ - const Date &get_destruction_time() const; - - /*! - * - * \fn get_states - * \brief Returns the list of the states between min and max - * \param min Time of the beginning of the list - * \param max Time of the end of the list - * - */ - const EntityList &get_states(Date &min, Date &max) const; - - /*! - * - * \fn destroy - * \brief Sets the destruction time of the container - * \param date destruction time - * - */ - void destroy(Date &time); -}; - -#endif + + /*! + * + * \fn get_name + * \brief Returns the name and the alias of the container + * + */ + const Name &get_name() const; + + /*! + * + * \fn get_parent + * \brief Returns the parent container + * + */ + const Container *get_parent() const; + + /*! + * + * \fn get_type + * \brief Returns the type of the container + * + */ + const ContainerType *get_type() const; + + /*! + * + * \fn get_children + * \brief Returns the list of the child containers + * + */ + const list<Container *> &get_children() const; + + /*! + * + * \fn get_creation_time + * \brief Returns the time when the container was created + * + */ + const Date &get_creation_time() const; + + /*! + * + * \fn get_destruction_time + * \brief Returns the time when the container was destroyed + * + */ + const Date &get_destruction_time() const; + + /*! + * + * \fn get_states + * \brief Returns the list of the states between min and max + * \param min Time of the beginning of the list + * \param max Time of the end of the list + * + */ + const EntityList &get_states(Date &min, Date &max) const; + + /*! + * + * \fn destroy + * \brief Sets the destruction time of the container + * \param date destruction time + * + */ + void destroy(Date &time); +}; + +#endif diff --git a/trace/src/Entity.hpp b/trace/src/Entity.hpp index 5aefa41694febbd4d66c2b892622b001e4794c6e..8d48c3db93d66fe3859953c7bbf17f3c1cabd438 100644 --- a/trace/src/Entity.hpp +++ b/trace/src/Entity.hpp @@ -1,29 +1,29 @@ -#ifndef ENTITY_HPP -#define ENTITY_HPP - -/*! - * - * \file container.hpp - * \author Clément Vuchener - * \brief Contains the definition of the class Container - * \date 2009 January 30th - * - */ +#ifndef ENTITY_HPP +#define ENTITY_HPP + +/*! + * + * \file container.hpp + * \author Clément Vuchener + * \brief Contains the definition of the class Container + * \date 2009 January 30th + * + */ //class Entity; - -//#include "Container.hpp" - -/*! - * - * \class Container - * \brief abstract class that describe trace entities (events, states, links, variables) - * - */ -class Entity { -public: - -// virtual const Container *get_container() const = 0; -}; - -#endif + +//#include "Container.hpp" + +/*! + * + * \class Container + * \brief abstract class that describe trace entities (events, states, links, variables) + * + */ +class Entity { +public: + +// virtual const Container *get_container() const = 0; +}; + +#endif diff --git a/trace/src/EntityList.hpp b/trace/src/EntityList.hpp index 427994afba72ab00e294fcc7f40ec54fccf7bdf1..06904cb56781368bdd24795e7a5221224f934be6 100644 --- a/trace/src/EntityList.hpp +++ b/trace/src/EntityList.hpp @@ -1,28 +1,28 @@ -#ifndef ENTITYLIST_HPP -#define ENTITYLIST_HPP +#ifndef ENTITYLIST_HPP +#define ENTITYLIST_HPP -#include "Entity.hpp" - -struct EntityListElement { - EntityListElement *next; - EntityListElement *previous; - const Entity *ent; -}; - -class EntityList { -private: - EntityListElement *_beginning; - EntityListElement *_end; - EntityListElement *_current; - -public: - /*! - * - *\fn StructureChained() - *\brief Constructeur with an element - * - */ - EntityList(); +#include "Entity.hpp" + +struct EntityListElement { + EntityListElement *next; + EntityListElement *previous; + const Entity *ent; +}; + +class EntityList { +private: + EntityListElement *_beginning; + EntityListElement *_end; + EntityListElement *_current; + +public: + /*! + * + *\fn StructureChained() + *\brief Constructeur with an element + * + */ + EntityList(); /*! * @@ -31,79 +31,79 @@ public: * */ bool is_empty() const; - - /*! - * - *\fn go_beginning() - *\brief Set the current element to be the first of the list - * - */ - void go_beginning(); - - /*! - * - *\fn go_end() - *\brief Set the current element to be the last of the list - * - */ - void go_end(); - - /*! - * - *\fn insert_entity_after() - *\brief add an entity at the current position in the list - * - */ - void insert_after(const Entity *cont); - - - /*! - * - *\fn remove_entity() - *\brief Remove the current entity - * - */ - void remove_current(); - - /*! - * - *\fn next() - *\brief Return the next element - * - */ - void next(); - - /*! - * - *\fn has_next()() - *\brief Return if there is a following element - * - */ - bool has_next() const; - - /*! - * - *\fn return the previous element - *\brief Return if there is a previous element - * - */ - void previous(); - - /*! - * - *\fn has_previous()() - *\brief Return if there is a previous element - * - */ - bool has_previous() const; - - /*! - * - *\fn get_entity() - *\brief Returns the current entity - * - */ - const Entity *get_current_entity() const; -}; - -#endif + + /*! + * + *\fn go_beginning() + *\brief Set the current element to be the first of the list + * + */ + void go_beginning(); + + /*! + * + *\fn go_end() + *\brief Set the current element to be the last of the list + * + */ + void go_end(); + + /*! + * + *\fn insert_entity_after() + *\brief add an entity at the current position in the list + * + */ + void insert_after(const Entity *cont); + + + /*! + * + *\fn remove_entity() + *\brief Remove the current entity + * + */ + void remove_current(); + + /*! + * + *\fn next() + *\brief Return the next element + * + */ + void next(); + + /*! + * + *\fn has_next()() + *\brief Return if there is a following element + * + */ + bool has_next() const; + + /*! + * + *\fn return the previous element + *\brief Return if there is a previous element + * + */ + void previous(); + + /*! + * + *\fn has_previous()() + *\brief Return if there is a previous element + * + */ + bool has_previous() const; + + /*! + * + *\fn get_entity() + *\brief Returns the current entity + * + */ + const Entity *get_current_entity() const; +}; + +#endif diff --git a/trace/src/State.hpp b/trace/src/State.hpp index 40219d8bd90852ff83fadb69ff4d63a9a160e7f5..a5550c5a1c5ec8ef7d38f14f94b631c3bc9a0fa8 100644 --- a/trace/src/State.hpp +++ b/trace/src/State.hpp @@ -1,89 +1,89 @@ -#ifndef STATE_HPP -#define STATE_HPP - -/*! - * - * \file state.hpp - * \author Clément Vuchener - * \brief - * \date 2009 January 30th - * - */ - +#ifndef STATE_HPP +#define STATE_HPP + +/*! + * + * \file state.hpp + * \author Clément Vuchener + * \brief + * \date 2009 January 30th + * + */ + #include "Entity.hpp" #include "values/Date.hpp" #include "StateType.hpp" -#include "EntityValue.hpp" - -/*! - * - * \class State - * \brief An container state - * - */ +#include "EntityValue.hpp" + +/*! + * + * \class State + * \brief An container state + * + */ class State: public Entity { private: Date _start, _end; StateType *_type; Container *_container; - EntityValue *_value; + EntityValue *_value; + +public: + /*! + * + * \brief Constructor + * + */ + State(Date &start, Date &end, StateType *type, Container *container, EntityValue *value); + + /*! + * + * \fn get_start_time() const; + * \brief Returns the start time of the state + * + */ + const Date &get_start_time() const; + + /*! + * + * \fn get_end_time + * \brief Returns the end time of the state + * + */ + const Date &get_end_time() const; + + /*! + * + * \fn get_duration + * \brief Returns the duration of the state + * + */ + const double get_duration() const; + + /*! + * + * \fn get_type + * \brief Returns the type of the state + * + */ + const StateType *get_type() const; + + /*! + * + * \fn get_value + * \brief Returns the value of the state + * + */ + const EntityValue *get_value() const; + + /*! + * + * \fn get_container + * \brief Returns the container that contains the state + * + */ + const Container *get_container() const; +}; -public: - /*! - * - * \brief Constructor - * - */ - State(Date &start, Date &end, StateType *type, Container *container, EntityValue *value); - - /*! - * - * \fn get_start_time() const; - * \brief Returns the start time of the state - * - */ - const Date &get_start_time() const; - - /*! - * - * \fn get_end_time - * \brief Returns the end time of the state - * - */ - const Date &get_end_time() const; - - /*! - * - * \fn get_duration - * \brief Returns the duration of the state - * - */ - const double get_duration() const; - - /*! - * - * \fn get_type - * \brief Returns the type of the state - * - */ - const StateType *get_type() const; - - /*! - * - * \fn get_value - * \brief Returns the value of the state - * - */ - const EntityValue *get_value() const; - - /*! - * - * \fn get_container - * \brief Returns the container that contains the state - * - */ - const Container *get_container() const; -}; - -#endif +#endif