ASL
0.1.7
Advanced Simulation Library
debian
tmp
usr
include
ASL
utilities
aslUValue.h
Go to the documentation of this file.
1
/*
2
* Advanced Simulation Library <http://asl.org.il>
3
*
4
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5
*
6
*
7
* This file is part of Advanced Simulation Library (ASL).
8
*
9
* ASL is free software: you can redistribute it and/or modify it
10
* under the terms of the GNU Affero General Public License as
11
* published by the Free Software Foundation, version 3 of the License.
12
*
13
* ASL is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
17
*
18
* You should have received a copy of the GNU Affero General Public License
19
* along with ASL. If not, see <http://www.gnu.org/licenses/>.
20
*
21
*/
22
23
24
#ifndef ASLUVALUE_H
25
#define ASLUVALUE_H
26
27
#include "
aslTimeStamp.h
"
28
#include <memory>
29
30
namespace
asl
31
{
32
34
template
<
typename
T>
class
UValue
35
{
36
public
:
37
std::shared_ptr<T>
p
;
38
TimeStamp
ts
;
39
inline
explicit
UValue
():
p
(new T){}
40
inline
explicit
UValue
(
const
T & a):
p
(new T(a)){
ts
.
update
();}
42
inline
const
T &
operator=
(
const
T& a){
ts
.
update
();
return
(*
p
= a);}
43
inline
const
T &
v
()
const
{
return
*
p
;};
44
inline
T &
v
() {
return
*
p
;};
45
};
46
48
template
<
typename
T>
inline
bool
operator==
(
const
asl::UValue<T>
& a,
const
T & v);
50
template
<
typename
T>
inline
bool
operator!=
(
const
asl::UValue<T>
& a,
const
T & v);
51
52
//-------------------------- Implementation --------------------------
53
54
55
template
<
typename
T>
inline
bool
operator==
(
const
asl::UValue<T>
& a,
const
T & v)
56
{
57
return
*(a.
p
) == v;
58
}
59
60
template
<
typename
T>
inline
bool
operator!=
(
const
asl::UValue<T>
& a,
const
T & v)
61
{
62
return
*(a.
p
) != v;
63
}
64
65
}
//namespace asl
66
67
68
#endif // ASLUVALUE_H
asl::operator!=
const bool operator!=(const AVec< T > &a, const AVec< T > &b)
Definition:
aslVectorsDynamicLengthOperations.h:246
asl::UValue::ts
TimeStamp ts
Definition:
aslUValue.h:38
aslTimeStamp.h
asl::UValue
Updatable value. This class stores value and its TimeStamp.
Definition:
aslBasicBC.h:41
asl::UValue::v
T & v()
Definition:
aslUValue.h:44
asl::UValue::v
const T & v() const
Definition:
aslUValue.h:43
asl::operator==
bool operator==(const std::vector< T > &vector1, const std::vector< T > &vector2)
Compares two vectors.
Definition:
aslUtilities.h:185
asl::UValue::operator=
const T & operator=(const T &a)
updates UValue::ts automaticaly
Definition:
aslUValue.h:42
asl::TimeStamp
Definition:
aslTimeStamp.h:31
asl::UValue::UValue
UValue(const T &a)
Definition:
aslUValue.h:40
asl::UValue::p
std::shared_ptr< T > p
Definition:
aslUValue.h:37
asl::UValue::UValue
UValue()
Definition:
aslUValue.h:39
asl
Advanced Simulation Library.
Definition:
aslDataInc.h:30
asl::TimeStamp::update
void update()
Definition:
aslTimeStamp.h:39
Generated by
1.8.17