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 293 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 311 of file JProperties.hh.
311 :
313 {
314 reset(
new JPropertiesTemplateElement<T>(value));
315 }
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 324 of file JProperties.hh.
325 {
326 return get()->equals(*element.get());
327 }
virtual JClass_t * get() const override
Get pointer.
◆ operator=()
Assignment operator.
- Parameters
-
value | reference to template object |
- Returns
- this JPropertiesElement
Definition at line 337 of file JProperties.hh.
338 {
339 reset(
new JPropertiesTemplateElement<T>(value));
340
341 return *this;
342 }
◆ getValue() [1/2]
template<class T >
const T & JEEP::JPropertiesElement::getValue |
( |
| ) |
const |
|
inline |
Get value.
- Returns
- value of this JPropertiesElement
Definition at line 351 of file JProperties.hh.
352 {
353 const JPropertiesTemplateElement<T>* p =
dynamic_cast<const JPropertiesTemplateElement<T>*
>(this->
get());
354
355 if (p != NULL)
356 return p->object;
357 else
358 THROW(JPropertiesException,
"Inconsistent data type.");
359 }
#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 368 of file JProperties.hh.
369 {
370 JPropertiesTemplateElement<T>* p =
dynamic_cast<JPropertiesTemplateElement<T>*
>(this->
get());
371
372 if (p != NULL)
373 return p->object;
374 else
375 THROW(JPropertiesException,
"Inconsistent data type.");
376 }
◆ setValue()
template<class T >
void JEEP::JPropertiesElement::setValue |
( |
const T & | value | ) |
|
|
inline |
Set value of this JPropertiesElement.
- Parameters
-
Definition at line 386 of file JProperties.hh.
387 {
388 JPropertiesTemplateElement<T>* p =
dynamic_cast<JPropertiesTemplateElement<T>*
>(this->
get());
389
390 if (p != NULL)
391 p->object = value;
392 else
393 THROW(JPropertiesException,
"Inconsistent data type.");
394 }
◆ toString()
std::string JEEP::JPropertiesElement::toString |
( |
| ) |
const |
|
inline |
Convert to string.
- Returns
- value of this JPropertiesElement
Definition at line 402 of file JProperties.hh.
403 {
404 std::ostringstream os;
405
406 get()->write(os,
"",
'\0');
407
408 return os.str();
409 }
◆ toValue()
template<class T >
T JEEP::JPropertiesElement::toValue |
( |
| ) |
const |
|
inline |
Convert to template type.
- Returns
- value of this JPropertiesElement
Definition at line 418 of file JProperties.hh.
419 {
420 T value;
421
422 std::istringstream in(this->
toString());
423
424 in >> value;
425
426 return value;
427 }
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 458 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: