nl::Weave::System::Object

#include <src/system/SystemObject.h>

This represents a reference-counted object allocated from space contained in an ObjectPool object.

Summary

Note:Instance of this class may only be constructed using the related ObjectPool class template. The copy constructor and the assignment operator are deleted. A reference counting system is used to track retentions of instances of this class. When an object is initially retained, its reference count is one. Additional retentions may increment the reference count. When the object is released, the reference count is decremented. When the reference count is zero, the object is recycled back to the pool for reallocation. There is no destructor available. Subclasses must be designed to ensure that all encapsulated resources are released when the final retention is released and the object is recycled. While this class is defined as concrete, in conformance with Nest C++ style, it should be regarded as abstract.

Inheritance

Direct Known Subclasses:
  nl::Inet::InetLayerBasis
  nl::Weave::System::Timer

Protected types

ReleaseDeferralErrorTactic{
  kReleaseDeferralErrorTactic_Ignore,
  kReleaseDeferralErrorTactic_Release,
  kReleaseDeferralErrorTactic_Die
}
enum
< What to do when DeferredRelease fails to post a kEvent_ReleaseObj.

Public attributes

AppState
void *
Generic pointer to app-specific data associated with the object.

Public functions

IsRetained(const Layer & aLayer) const
bool
Test whether this object is retained by aLayer.
Release(void)
void
Decrements the reference count for the Weave System Layer object.
Retain(void)
void
Increments the reference count for the Weave System Layer object.
SystemLayer(void) const
Layer &
Returns a reference to the Weave System Layer object provided when the object was initially retained from its corresponding
object pool instance.

Protected functions

DeferredRelease(ReleaseDeferralErrorTactic aTactic)
void

Protected types

ReleaseDeferralErrorTactic

 ReleaseDeferralErrorTactic

< What to do when DeferredRelease fails to post a kEvent_ReleaseObj.

Public attributes

AppState

void * AppState

Generic pointer to app-specific data associated with the object.

Public functions

IsRetained

bool IsRetained(
  const Layer & aLayer
) const 

Test whether this object is retained by aLayer.

Tests whether this object is retained by \c aLayer.

Concurrency safe.

Release

void Release(
  void
)

Decrements the reference count for the Weave System Layer object.

Recycles the object back into the pool if the reference count is decremented to zero. No destructor is invoked.

Retain

void Retain(
  void
)

Increments the reference count for the Weave System Layer object.

The object is assumed to be live.

SystemLayer

Layer & SystemLayer(
  void
) const 

Returns a reference to the Weave System Layer object provided when the object was initially retained from its corresponding
object pool instance.

The object is assumed to be live.

Protected functions

DeferredRelease

void DeferredRelease(
  ReleaseDeferralErrorTactic aTactic
)