Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
vite
Commits
bec6385a
Commit
bec6385a
authored
Feb 09, 2009
by
Clément Vuchener
Browse files
Déplacement des valeurs et implémentation de State et autres corrections
parent
2a3c9a10
Changes
25
Hide whitespace changes
Inline
Side-by-side
trace/src/Container.cpp
View file @
bec6385a
...
...
@@ -4,6 +4,14 @@ Container::Container(Name &name, Date &creation_time, ContainerType *type, Conta
_name
(
name
),
_creation_time
(
creation_time
),
_type
(
type
),
_parent
(
parent
)
{
_parent
->
_children
.
push_back
(
this
);
}
Container
::~
Container
()
{
_states
.
go_beginning
();
while
(
!
_states
.
is_empty
())
{
delete
_states
.
get_current_entity
();
_states
.
remove_current
();
}
}
const
Name
&
Container
::
get_name
()
const
{
return
_name
;
...
...
trace/src/Container.hpp
View file @
bec6385a
...
...
@@ -13,13 +13,14 @@
#include <list>
using
std
::
list
;
#include "
../../
values/
n
ame.hpp"
#include "
../../
values/
d
ate.hpp"
#include "values/
N
ame.hpp"
#include "values/
D
ate.hpp"
#include "ContainerType.hpp"
class
Container
;
#include "State.hpp"
#include "EntityList.hpp"
...
...
@@ -30,15 +31,18 @@ class Container;
*
*/
class
Container
{
friend
class
State
;
private:
Name
_name
;
Date
_creation_time
,
_destruction_time
;
ContainerType
*
_type
;
Container
*
_parent
;
list
<
Container
*>
_children
;
EntityList
_states
;
public:
Container
(
Name
&
name
,
Date
&
creation_time
,
ContainerType
*
type
,
Container
*
parent
);
~
Container
();
/*!
*
...
...
trace/src/ContainerType.hpp
View file @
bec6385a
...
...
@@ -4,7 +4,7 @@
#include <list>
using
std
::
list
;
#include "
../../
values/
n
ame.hpp"
#include "values/
N
ame.hpp"
/*!
*
...
...
trace/src/Entity.hpp
View file @
bec6385a
...
...
@@ -9,8 +9,10 @@
* \date 2009 January 30th
*
*/
//class Entity;
#include "Container.hpp"
//
#include "Container.hpp"
/*!
*
...
...
@@ -21,7 +23,7 @@
class
Entity
{
public:
Container
&
get_container
()
const
;
//
virtual const
Container
*
get_container() const
= 0
;
};
#endif
trace/src/EntityList.cpp
View file @
bec6385a
...
...
@@ -5,6 +5,10 @@ EntityList::EntityList() {
_end
=
0
;
_current
=
0
;
}
bool
EntityList
::
is_empty
()
const
{
return
_current
==
0
;
}
void
EntityList
::
go_beginning
()
{
_current
=
_beginning
;
...
...
trace/src/EntityList.hpp
View file @
bec6385a
#ifndef ENTITYLIST_HPP
#define ENTITYLIST_HPP
class
EntityList
;
#include "Entity.hpp"
struct
EntityListElement
{
...
...
@@ -25,6 +23,14 @@ public:
*
*/
EntityList
();
/*!
*
* \fn is_empty
* \return true if the list is empty
*
*/
bool
is_empty
()
const
;
/*!
*
...
...
trace/src/State.cpp
0 → 100644
View file @
bec6385a
#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
);
}
const
Date
&
State
::
get_start_time
()
const
{
return
_start
;
}
const
Date
&
State
::
get_end_time
()
const
{
return
_end
;
}
const
double
State
::
get_duration
()
const
{
return
_end
-
_start
;
}
const
StateType
*
State
::
get_type
()
const
{
return
_type
;
}
const
EntityValue
*
State
::
get_value
()
const
{
return
_value
;
}
const
Container
*
State
::
get_container
()
const
{
return
_container
;
}
trace/src/State.hpp
View file @
bec6385a
...
...
@@ -10,7 +10,11 @@
*
*/
#include "entity.hpp"
#include "Entity.hpp"
#include "values/Date.hpp"
#include "StateType.hpp"
#include "EntityValue.hpp"
/*!
*
...
...
@@ -18,14 +22,20 @@
* \brief An container state
*
*/
class
State
:
public
Entity
{
class
State
:
public
Entity
{
private:
Date
_start
,
_end
;
StateType
*
_type
;
Container
*
_container
;
EntityValue
*
_value
;
public:
/*!
*
* \brief Constructor
*
*/
State
(
Date
&
start
,
Date
&
end
,
StateType
&
type
,
Container
&
container
,
EntityValue
&
value
);
State
(
Date
&
start
,
Date
&
end
,
StateType
*
type
,
Container
*
container
,
EntityValue
*
value
);
/*!
*
...
...
@@ -57,7 +67,7 @@ public:
* \brief Returns the type of the state
*
*/
const
StateType
&
get_type
()
const
;
const
StateType
*
get_type
()
const
;
/*!
*
...
...
@@ -65,7 +75,7 @@ public:
* \brief Returns the value of the state
*
*/
const
EntityValue
&
get_value
()
const
;
const
EntityValue
*
get_value
()
const
;
/*!
*
...
...
@@ -73,7 +83,7 @@ public:
* \brief Returns the container that contains the state
*
*/
const
Container
&
get_container
()
const
;
const
Container
*
get_container
()
const
;
};
#endif
trace/src/StateType.hpp
View file @
bec6385a
...
...
@@ -8,44 +8,28 @@
*
*/
//#include "EntityType.hpp"
#include "values/Name.hpp"
#include "ContainerType.hpp"
/*!
*
*\class StateType
*\brief The class that describes the states
*
*/
class
StateType
:
public
EntityType
{
Name
type
;
class
StateType
/*: public EntityType*/
{
private:
Name
_name
;
ContainerType
*
_container_type
;
public
:
/*!
*
*\fn get_entity_type
*\brief Return the type of the entity
*
*/
const
EntityType
&
get_entity_type
()
const
;
/*!
*
*\fn set_type
*\brief Set the type of the state
*\param type The new type of the state
*
*/
void
set_entity_type
(
const
EntityType
&
type
);
/*!
*
*\fn has_same_type
*\brief Return if the type of the state is equal to the type of the parameter
*\param A container type
*
*/
bool
has_same_type
(
const
EntityType
&
type
)
const
;
StateType
(
const
Name
&
name
,
ContainerType
*
container_type
);
Name
get_name
()
const
;
const
ContainerType
*
get_container_type
()
const
;
};
#endif
values/
c
olor.cpp
→
trace/src/
values/
C
olor.cpp
View file @
bec6385a
File moved
values/
c
olor.hpp
→
trace/src/
values/
C
olor.hpp
View file @
bec6385a
...
...
@@ -11,7 +11,7 @@
*/
#include <sstream>
#include "
v
alue.hpp"
#include "
V
alue.hpp"
/*!
*
...
...
values/
d
ate.cpp
→
trace/src/
values/
D
ate.cpp
View file @
bec6385a
...
...
@@ -24,22 +24,22 @@ std::string Date::to_string() const{
return
oss
.
str
();
}
bool
Date
::
operator
<
(
Date
&
d
)
const
{
bool
Date
::
operator
<
(
const
Date
&
d
)
const
{
return
(
_value
<
d
.
_value
);
}
bool
Date
::
operator
>
(
Date
&
d
)
const
{
bool
Date
::
operator
>
(
const
Date
&
d
)
const
{
return
(
_value
>
d
.
_value
);
}
bool
Date
::
operator
<=
(
Date
&
d
)
const
{
bool
Date
::
operator
<=
(
const
Date
&
d
)
const
{
return
(
_value
<=
d
.
_value
);
}
bool
Date
::
operator
>=
(
Date
&
d
)
const
{
bool
Date
::
operator
>=
(
const
Date
&
d
)
const
{
return
(
_value
>=
d
.
_value
);
}
double
Date
::
operator
-
(
Date
&
d
)
const
{
double
Date
::
operator
-
(
const
Date
&
d
)
const
{
return
(
_value
-
d
.
_value
);
}
values/
d
ate.hpp
→
trace/src/
values/
D
ate.hpp
View file @
bec6385a
...
...
@@ -10,7 +10,7 @@
*
*/
#include "
v
alue.hpp"
#include "
V
alue.hpp"
#include <sstream>
#include <cstdio>
...
...
@@ -53,11 +53,11 @@ public:
*/
std
::
string
to_string
()
const
;
bool
operator
<
(
Date
&
)
const
;
bool
operator
>
(
Date
&
)
const
;
bool
operator
<=
(
Date
&
)
const
;
bool
operator
>=
(
Date
&
)
const
;
double
operator
-
(
Date
&
)
const
;
bool
operator
<
(
const
Date
&
)
const
;
bool
operator
>
(
const
Date
&
)
const
;
bool
operator
<=
(
const
Date
&
)
const
;
bool
operator
>=
(
const
Date
&
)
const
;
double
operator
-
(
const
Date
&
)
const
;
};
#endif // DATE_HPP
values/
d
ouble.cpp
→
trace/src/
values/
D
ouble.cpp
View file @
bec6385a
File moved
values/
d
ouble.hpp
→
trace/src/
values/
D
ouble.hpp
View file @
bec6385a
...
...
@@ -10,7 +10,7 @@
*
*/
#include "
v
alue.hpp"
#include "
V
alue.hpp"
#include <sstream>
#include <cstdio>
...
...
values/
h
ex.cpp
→
trace/src/
values/
H
ex.cpp
View file @
bec6385a
File moved
values/
h
ex.hpp
→
trace/src/
values/
H
ex.hpp
View file @
bec6385a
...
...
@@ -14,7 +14,7 @@
#include <iostream>
#include <fstream>
#include <cstdio>
#include "
v
alue.hpp"
#include "
V
alue.hpp"
/*!
*
...
...
values/
i
nteger.cpp
→
trace/src/
values/
I
nteger.cpp
View file @
bec6385a
File moved
values/
i
nteger.hpp
→
trace/src/
values/
I
nteger.hpp
View file @
bec6385a
...
...
@@ -12,7 +12,7 @@
#include <sstream>
#include <cstdio>
#include "
v
alue.hpp"
#include "
V
alue.hpp"
/*!
*
...
...
values/
n
ame.cpp
→
trace/src/
values/
N
ame.cpp
View file @
bec6385a
...
...
@@ -16,6 +16,11 @@ Name::Name(name_only_t name_only, std::string name) {
Name
::
Name
(
alias_only_t
alias_only
,
std
::
string
alias
)
{
_name
.
clear
();
_alias
=
alias
;
}
Name
::
Name
(
Name
&
name
)
{
_name
=
name
.
_name
;
_alias
=
name
.
_alias
;
}
std
::
string
Name
::
to_string
()
const
{
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment