The property value class.
More...
#include <JProperties.hh>
|
static void | release (JClass_t *p) |
| Release memory.
|
|
|
void | set (const JSharedPointer &object) |
| Set pointer.
|
|
virtual void | set (JClass_t *p) override |
| Set pointer.
|
|
void | release () |
| Release memory.
|
|
The property value class.
This class consists of a pointer to the JPropertiesElementInterface. This class implements the assignment and type conversion operators.
Definition at line 295 of file JProperties.hh.
◆ pointer_type
template<class JClass_t , template< class > class JMemory_t = JNew>
◆ storage_type
template<class JClass_t , template< class > class JMemory_t = JNew>
◆ memory_type
◆ JPropertiesElement() [1/2]
JEEP::JPropertiesElement::JPropertiesElement |
( |
| ) |
|
|
inline |
◆ JPropertiesElement() [2/2]
template<class T >
JEEP::JPropertiesElement::JPropertiesElement |
( |
T & | value | ) |
|
|
inline |
Constructor.
- Parameters
-
value | reference to template object |
Definition at line 313 of file JProperties.hh.
313 :
315 {
316 reset(
new JPropertiesTemplateElement<T>(value));
317 }
virtual void reset() override
Reset pointer.
◆ equals() [1/2]
Equality between property elements.
- Parameters
-
element | properties element |
- Returns
- true if equal; else false
Definition at line 326 of file JProperties.hh.
327 {
328 return get()->equals(*element.get());
329 }
virtual JClass_t * get() const override
Get pointer.
◆ operator=()
Assignment operator.
- Parameters
-
value | reference to template object |
- Returns
- this JPropertiesElement
Definition at line 339 of file JProperties.hh.
340 {
341 reset(
new JPropertiesTemplateElement<T>(value));
342
343 return *this;
344 }
◆ getValue() [1/2]
template<class T >
const T & JEEP::JPropertiesElement::getValue |
( |
| ) |
const |
|
inline |
Get value.
- Returns
- value of this JPropertiesElement
Definition at line 353 of file JProperties.hh.
354 {
355 const JPropertiesTemplateElement<T>* p =
dynamic_cast<const JPropertiesTemplateElement<T>*
>(this->
get());
356
357 if (p != NULL)
358 return p->object;
359 else
360 THROW(JPropertiesException,
"Inconsistent data type.");
361 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
◆ getValue() [2/2]
template<class T >
T & JEEP::JPropertiesElement::getValue |
( |
| ) |
|
|
inline |
Get value.
- Returns
- value of this JPropertiesElement
Definition at line 370 of file JProperties.hh.
371 {
372 JPropertiesTemplateElement<T>* p =
dynamic_cast<JPropertiesTemplateElement<T>*
>(this->
get());
373
374 if (p != NULL)
375 return p->object;
376 else
377 THROW(JPropertiesException,
"Inconsistent data type.");
378 }
◆ setValue()
template<class T >
void JEEP::JPropertiesElement::setValue |
( |
const T & | value | ) |
|
|
inline |
Set value of this JPropertiesElement.
- Parameters
-
Definition at line 388 of file JProperties.hh.
389 {
390 JPropertiesTemplateElement<T>* p =
dynamic_cast<JPropertiesTemplateElement<T>*
>(this->
get());
391
392 if (p != NULL)
393 p->object = value;
394 else
395 THROW(JPropertiesException,
"Inconsistent data type.");
396 }
◆ toString()
std::string JEEP::JPropertiesElement::toString |
( |
| ) |
const |
|
inline |
Convert to string.
- Returns
- value of this JPropertiesElement
Definition at line 404 of file JProperties.hh.
405 {
406 std::ostringstream os;
407
408 get()->write(os,
"",
'\0');
409
410 return os.str();
411 }
◆ toValue()
template<class T >
T JEEP::JPropertiesElement::toValue |
( |
| ) |
const |
|
inline |
Convert to template type.
- Returns
- value of this JPropertiesElement
Definition at line 420 of file JProperties.hh.
421 {
422 T value;
423
424 std::istringstream in(this->
toString());
425
426 in >> value;
427
428 return value;
429 }
std::string toString() const
Convert to string.
◆ operator const T &()
template<class T >
JEEP::JPropertiesElement::operator const T & |
( |
| ) |
const |
|
inline |
◆ getEndMarker()
bool JEEP::JPropertiesElement::getEndMarker |
( |
| ) |
const |
|
inline |
◆ setEndMarker()
void JEEP::JPropertiesElement::setEndMarker |
( |
const bool | marker | ) |
|
|
inline |
Set end marker.
- Parameters
-
marker | if true stop reading after this properties element, else continue |
Definition at line 460 of file JProperties.hh.
◆ getSharedPointer() [1/2]
template<class JClass_t , template< class > class JMemory_t = JNew>
Get shared pointer.
- Returns
- this shared pointer
Definition at line 95 of file JSharedPointer.hh.
96 {
98 }
JSharedPointer()
Default constructor.
◆ getSharedPointer() [2/2]
template<class JClass_t , template< class > class JMemory_t = JNew>
◆ setSharedPointer()
template<class JClass_t , template< class > class JMemory_t = JNew>
Set shared pointer.
- Parameters
-
Definition at line 117 of file JSharedPointer.hh.
118 {
119 if (this->
get() !=
object.
get()) {
120
122
125 }
126 }
127 }
bool is_valid() const
Check validity of pointer.
void set(const JSharedPointer &object)
Set pointer.
◆ reset() [1/3]
template<class JClass_t , template< class > class JMemory_t = JNew>
|
inlineoverridevirtualinherited |
Reset pointer.
The reference counter is decremented by one and the object pointed to previously is deleted when its reference counter is zero.
Reimplemented from JLANG::JStorage< JClass_t, JNew >.
Definition at line 171 of file JSharedPointer.hh.
172 {
175 }
176
178 }
virtual void reset() override
Reset pointer.
virtual void reset() override
Reset pointer.
◆ reset() [2/3]
Reset pointer.
- Parameters
-
Definition at line 35 of file JPointer.hh.
109 {
110 this->
reset(pointer.get());
111 }
◆ reset() [3/3]
template<class JClass_t >
Reset pointer.
- Parameters
-
Definition at line 94 of file JAbstractPointer.hh.
95 {
96 if (this->
get() != p) {
97
99
100 if (p != NULL) {
102 }
103 }
104 }
virtual void set(JClass_t *p)=0
Set pointer.
virtual JClass_t * get() const =0
Get pointer.
virtual void reset()=0
Reset pointer.
◆ set() [1/3]
template<class JClass_t , template< class > class JMemory_t = JNew>
Set pointer.
The reference counter of the shared object pointed to is incremented by one.
- Parameters
-
Definition at line 188 of file JSharedPointer.hh.
189 {
191
193 }
virtual void set(JClass_t *p) override
Set pointer.
void attach(const JSharedCounter &object)
Attach this counter to given shared counter object.
◆ set() [2/3]
template<class JClass_t , template< class > class JMemory_t = JNew>
|
inlineoverrideprotectedvirtualinherited |
Set pointer.
The reference counter of the shared object pointed to is initialised to one.
- Parameters
-
p | pointer to derived class object |
Reimplemented from JLANG::JPointer< JClass_t >.
Definition at line 202 of file JSharedPointer.hh.
203 {
205
207 }
void initialise()
Initialise counter.
◆ set() [3/3]
template<class JClass_t >
template<class T >
Set pointer.
- Parameters
-
Definition at line 96 of file JPointer.hh.
97 {
98 this->
set(pointer.get());
99 }
◆ initialise()
void JLANG::JSharedCounter::initialise |
( |
| ) |
|
|
inlineinherited |
◆ attach()
Attach this counter to given shared counter object.
- Parameters
-
Definition at line 46 of file JSharedCounter.hh.
47 {
49
51
53 ++(*counter);
54 }
55 }
◆ detach()
bool JLANG::JSharedCounter::detach |
( |
| ) |
|
|
inlineinherited |
Detach.
- Returns
- true if counter at zero; else false
Definition at line 63 of file JSharedCounter.hh.
64 {
66
68
70
72
73 return true;
74 }
75
77 }
78
79 return false;
80 }
◆ getCount()
const int JLANG::JSharedCounter::getCount |
( |
| ) |
|
|
inlineinherited |
◆ recreate()
Recreate object in memory.
A new object is created if no memory is allocated yet, else the previously created object is maintained.
Definition at line 57 of file JStorage.hh.
58 {
61 }
62 }
static JClass_t * create()
Create object in memory.
◆ create() [1/2]
Create object in memory.
The memory allocated by a previously created object will be released.
Definition at line 69 of file JStorage.hh.
◆ create() [2/2]
Create array of objects in memory.
The memory allocated by previously created objects will be released.
- Parameters
-
Definition at line 81 of file JStorage.hh.
◆ release() [1/2]
Release memory.
Definition at line 91 of file JStorage.hh.
92 {
94 }
static void release(JClass_t *p)
Release memory.
◆ release() [2/2]
template<class JClass_t >
static void JLANG::JNew< JClass_t >::release |
( |
JClass_t * | p | ) |
|
|
inlinestaticinherited |
Release memory.
- Parameters
-
Definition at line 41 of file JMemory.hh.
◆ get()
template<class JClass_t >
|
inlineoverridevirtualinherited |
◆ getReference() [1/2]
template<class JClass_t >
Get rereference to internal pointer.
- Returns
- reference to internal pointer
Definition at line 119 of file JPointer.hh.
◆ getReference() [2/2]
template<class JClass_t >
Get rereference to internal pointer.
- Returns
- reference to internal pointer
Definition at line 130 of file JPointer.hh.
◆ equals() [2/2]
template<class JClass_t >
Equals.
The equality is evaluated by comparison of the internal pointers.
- Parameters
-
- Returns
- true if equals; else false
Definition at line 50 of file JAbstractPointer.hh.
51 {
52 return this->
get() ==
object.get();
53 }
◆ is_valid()
template<class JClass_t >
Check validity of pointer.
- Returns
- true if pointer not null; else false
Definition at line 83 of file JAbstractPointer.hh.
84 {
85 return this->
get() != NULL;
86 }
◆ operator->()
template<class JClass_t >
Smart pointer operator.
- Returns
- pointer to object
Definition at line 112 of file JAbstractPointer.hh.
113 {
115 THROW(JNullPointerException,
"JAbstractPointer::operator->()");
116 else
118 }
◆ operator JClass_t *()
template<class JClass_t >
◆ end_marker
bool JEEP::JPropertiesElement::end_marker |
|
private |
◆ counter
int* JLANG::JSharedCounter::counter |
|
protectedinherited |
◆ __p
template<class JClass_t >
The documentation for this class was generated from the following file: