Go to the documentation of this file.
29 #define DATASVC_REGISTRYENTRY_CPP
48 #define CAST_REGENTRY( x, y ) dynamic_cast<x>( y )
54 : m_path(
std::move(
path ) ), m_pParent( parent ) {
57 if ( sep != std::string::npos )
m_path.
erase( 0, sep );
66 if ( !m_isSoft ) m_pObject->setRegistry(
nullptr );
70 if ( !m_isSoft ) m_pAddress->setRegistry(
nullptr );
71 m_pAddress->release();
77 unsigned long cnt = --m_refCount;
78 if ( !m_refCount )
delete this;
86 assemblePath( m_fullpath );
101 setAddress( pAddress );
108 if ( m_pObject ) m_pObject->setRegistry(
this );
109 if ( m_pAddress ) m_pAddress->setRegistry(
this );
115 setAddress( pAddress );
124 if ( m_pAddress ) m_pAddress->release();
125 m_pAddress = pAddress;
134 if ( m_pObject ) m_pObject->release();
145 m_store.erase( i,
std::end( m_store ) );
148 return m_store.size();
153 if ( nam.front() ==
SEPARATOR ) nam.remove_prefix( 1 );
154 auto i =
std::find_if( m_store.begin(), m_store.end(), [&](
const auto* entry ) {
156 return entry->name().compare( 1, std::string::npos, nam.data(), nam.size() ) == 0;
176 return i_add( pEntry );
190 m_store.push_back( pEntry );
194 return m_store.size();
217 for (
auto& i : m_store ) {
224 m_store.erase( m_store.begin(), m_store.end() );
230 auto i =
std::find( m_store.begin(), m_store.end(), obj );
231 return ( i != m_store.end() ) ? ( *i ) :
nullptr;
237 while ( !
path.empty() ) {
242 auto cpath =
path.substr( 0, loc1 );
243 if ( loc1 != std::string_view::npos ) {
244 path.remove_prefix( loc1 + 1 );
246 path = std::string_view{};
249 [&](
const auto& reg ) {
return cpath == std::string_view{ reg->name() }.substr( 1 ); } );
256 if ( cpath != std::string_view{ m_path }.substr( 1 ) )
break;
267 if ( result )
return result;
269 for (
const auto& i : m_store ) {
273 if ( result )
return result;
285 for (
auto& i : m_store ) {
297 if ( m_pParent ) m_pParent->assemblePath( buffer );
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
long i_add(RegistryEntry *entry)
Internal method to add entries.
std::string m_path
Path name.
void setParent(RegistryEntry *pParent)
Set new parent pointer.
bool isSoft() const
Is the link soft or hard.
virtual unsigned long addRef()=0
Add reference to object.
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
void makeHard(DataObject *pObject)
Initialize link as hard link.
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
std::string m_fullpath
String containing full path of the object (volatile)
unsigned long addRef() override
IInterface implementation: Dereference the object.
unsigned long release() override
IInterface implementation: Reference the object.
IOpaqueAddress * address() const override
Retrieve opaque storage address.
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode remove(std::string_view name)
Remove an entry from the store.
void setObject(DataObject *obj)
Set/Update object address.
#define CAST_REGENTRY(x, y)
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
void makeSoft(DataObject *pObject)
Initialize link as soft link.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
constexpr static const auto SUCCESS
long deleteElements()
Delete all contained elements.
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
constexpr static const auto FAILURE
RegistryEntry * i_create(std::string name)
Internal method to create entries.
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
virtual unsigned long addRef()
Add reference to object.
~RegistryEntry() override
Standard Destructor.