Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 95823202 authored by Clément Vuchener's avatar Clément Vuchener
Browse files

Correction des problèmes de définitions croisees et implémentation de classes

parent db51be7d
No related branches found
No related tags found
No related merge requests found
......@@ -3,17 +3,19 @@
Container::Container(Name &name, Date &creation_time, ContainerType *type, Container *parent):
_name(name), _creation_time(creation_time), _type(type), _parent(parent) {
_parent->_children.push_back(this);
_states = new EntityList;
}
Container::~Container() {
_states.go_beginning();
while (!_states.is_empty()) {
delete _states.get_current_entity();
_states.remove_current();
_states->go_beginning();
while (!_states->is_empty()) {
delete _states->get_current_entity();
_states->remove_current();
}
delete _states;
}
const Name &Container::get_name() const {
Name Container::get_name() const {
return _name;
}
......@@ -25,23 +27,23 @@ const ContainerType *Container::get_type() const {
return _type;
}
const list<Container *> &Container::get_children() const {
list<Container *> Container::get_children() const {
return _children;
}
const Date &Container::get_creation_time() const {
Date Container::get_creation_time() const {
return _creation_time;
}
const Date &Container::get_destruction_time() const {
Date Container::get_destruction_time() const {
return _destruction_time;
}
const EntityList &Container::get_states(Date &min, Date &max) const {
EntityList Container::get_states() const {
// TO DO
}
void Container::destroy(Date &time) {
void Container::destroy(const Date &time) {
_destruction_time = time;
}
......@@ -38,12 +38,11 @@ private:
ContainerType *_type;
Container *_parent;
list<Container *> _children;
EntityList _states;
EntityList *_states;
public:
Container(Name &name, Date &creation_time, ContainerType *type, Container *parent);
~Container();
<<<<<<< .mine
/*!
*
......
......@@ -8,7 +8,7 @@ const ContainerType *ContainerType::get_parent() const {
return _parent;
}
const list<ContainerType *> &ContainerType::get_children() const {
list<ContainerType *> ContainerType::get_children() const {
return _children;
}
#include "Entity.hpp"
Entity::Entity(Container *container): _container(container) {
};
const Container *Entity::get_container() const {
return _container;
}
......@@ -10,9 +10,8 @@
*
*/
//class Entity;
//#include "Container.hpp"
class Entity;
class Container;
/*!
*
......@@ -21,9 +20,17 @@
*
*/
class Entity {
private:
Container *_container;
protected:
Entity(Container *container);
public:
// virtual const Container *get_container() const = 0;
const Container *get_container() const;
};
#include "Container.hpp"
#endif
#ifndef ENTITYLIST_HPP
#define ENTITYLIST_HPP
class EntityList;
#include "Entity.hpp"
struct EntityListElement {
......
#include "EntityType.hpp"
EntityType::EntityType(ContainerType *container_type): _container_type(container_type) {
}
const ContainerType *EntityType::get_container_type() const {
return _container_type;
}
......@@ -8,6 +8,11 @@
*
*/
#include "ContainerType.hpp"
class EntityType;
#include "EntityValue.hpp"
/*!
*
......@@ -16,48 +21,31 @@
* \brief Inherit from StateType
*
*/
class EntityType{
Name type;
/*!
*
*\fn EntityType
*\brief Default constructor
*
*/
EntityType();
class EntityType {
friend class EntityValue;
private:
ContainerType *_container_type;
list<EntityValue *> _values;
protected:
/*!
*
*\fn EntityType
*\brief Default constructor
*
*/
EntityType(ContainerType *container_type);
public :
/*!
*
*\fn get_containeur_type
*\brief Return the type of the container
*
*/
const ContainerType& get_container_type() const;
/*!
*
*\fn set_type
*\brief Set the type of the entity
*\param type The new type of the entity
*
*/
void set_container_type(const ContainerType &type);
/*!
*
*\fn has_same_type
*\brief Return if the type of the entity is equal to the type of the parameter
*\param A container type
*
*/
bool has_same_type(const ContainerType &type) const;
/*!
*
*\fn get_containeur_type
*\brief Return the type of the container
*
*/
const ContainerType *get_container_type() const;
};
#endif
#include "EntityValue.hpp"
EntityValue::EntityValue(const Name &name, EntityType *type): _name(name), _type(type) {
type->_values.push_back(this);
}
Name EntityValue::get_name() const {
return _name;
}
const EntityType *EntityValue::get_type() const {
return _type;
}
......@@ -9,7 +9,10 @@
* \date 2009 January 30th
*
*/
class EntityValue;
#include "EntityType.hpp"
/*!
*
......@@ -17,12 +20,16 @@
* \brief describe the value of an entity
*
*/
class EntityValue {
class EntityValue {
private:
Name _name;
EntityType *_type;
public:
EntityValue(Name &name, EntityType &type);
EntityValue(const Name &name, EntityType *type);
const Name &get_name() const;
const EntityType &get_type() const;
Name get_name() const;
const EntityType *get_type() const;
};
#endif
#include "State.hpp"
State::State(Date &start, Date &end, StateType *type, Container *container, EntityValue *value):
_start(start), _end(end), _type(type), _container(container), _value(value) {
_container->_states.go_end();
_container->_states.insert_after(this);
Entity(container), _start(start), _end(end), _type(type), _value(value) {
this->get_container()->_states->go_end();
this->get_container()->_states->insert_after(this);
}
const Date &State::get_start_time() const {
......@@ -25,8 +25,4 @@ const StateType *State::get_type() const {
const EntityValue *State::get_value() const {
return _value;
}
const Container *State::get_container() const {
return _container;
}
......@@ -26,7 +26,6 @@ class State: public Entity {
private:
Date _start, _end;
StateType *_type;
Container *_container;
EntityValue *_value;
public:
......@@ -76,14 +75,6 @@ public:
*
*/
const EntityValue *get_value() const;
/*!
*
* \fn get_container
* \brief Returns the container that contains the state
*
*/
const Container *get_container() const;
};
#endif
#include "StateType.hpp"
StateType::StateType(const Name &name, ContainerType *container_type):
EntityType(container_type), _name(name) {
};
Name StateType::get_name() const {
return _name;
};
......@@ -8,7 +8,7 @@
*
*/
//#include "EntityType.hpp"
#include "EntityType.hpp"
#include "values/Name.hpp"
#include "ContainerType.hpp"
......@@ -19,17 +19,14 @@
*\brief The class that describes the states
*
*/
class StateType /*: public EntityType*/ {
class StateType : public EntityType {
private:
Name _name;
ContainerType *_container_type;
public :
StateType(const Name &name, ContainerType *container_type);
Name get_name() const;
const ContainerType *get_container_type() const;
};
#endif
......@@ -32,7 +32,7 @@ Name::Name(alias_only_t alias_only, std::string alias) {
_alias = alias;
}
Name::Name(Name &name) {
Name::Name(const Name &name) {
_name = name._name;
_alias = name._alias;
}
......
......@@ -77,7 +77,7 @@ public:
* \brief Copy constructor
*
*/
Name(Name &);
Name(const Name &);
/*!
* \fn set_name(std::string &name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment