16#ifndef __OMNETPP_COBJECT_H
17#define __OMNETPP_COBJECT_H
21#include "simkerneldefs.h"
94 friend class cOwnedObject;
95 friend class cSoftOwner;
97#ifdef SIMFRONTEND_SUPPORT
99 virtual bool hasChangedSince(int64_t refreshSerial);
100 static int64_t getChangeCounter() {
return changeCounter;}
104#ifdef SIMFRONTEND_SUPPORT
106 static int64_t changeCounter;
110 virtual void ownedObjectDeleted(cOwnedObject *obj);
113 virtual void yieldOwnership(cOwnedObject *obj,
cObject *to);
117 void takeAllObjectsFrom(cSoftOwner *list);
154 virtual const char *
getName()
const {
return "";}
207 virtual std::string
str()
const;
217 virtual std::ostream&
printOn(std::ostream& os)
const;
243 virtual void take(cOwnedObject *obj);
252 virtual void drop(cOwnedObject *obj);
366typename std::enable_if<std::is_base_of<cObject, T>::value, std::ostream&>::type
367operator<<(std::ostream& os,
const T *p) {
369 return p->printOn(os);
371 return os <<
"<nullptr>";
375typename std::enable_if<std::is_base_of<cObject, T>::value, std::ostream&>::type
376operator<<(std::ostream& os,
const T& o) {
377 return o.printOn(os);
383typename std::enable_if<std::is_polymorphic<T>::value,
cObject*>::type
384as_cObject(T *p) {
return dynamic_cast<cObject*
>(p); }
387typename std::enable_if<!std::is_polymorphic<T>::value,
cObject*>::type
388as_cObject(T *p) {
return nullptr; }
391typename std::enable_if<std::is_polymorphic<T>::value,
const cObject*>::type
392as_cObject(
const T *p) {
return dynamic_cast<const cObject*
>(p); }
395typename std::enable_if<!std::is_polymorphic<T>::value,
const cObject*>::type
396as_cObject(
const T *p) {
return nullptr; }
422 noncopyable(
const noncopyable& x) =
delete;
423 const noncopyable& operator=(
const noncopyable&) =
delete;
Abstract base class for class descriptors.
Definition cclassdescriptor.h:40
Buffer for the communications layer of parallel simulation.
Definition ccommbuffer.h:42
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition cobject.h:93
virtual cObject * getOwner() const
Definition cobject.h:300
virtual const char * getFullName() const
Definition cobject.h:169
virtual void take(cOwnedObject *obj)
void copyNotSupported() const
cObject()
Definition cobject.h:124
virtual void drop(cOwnedObject *obj)
bool isName(const char *s) const
cObject * findObject(const char *name, bool deep=true)
cObject(const cObject &other)=default
virtual const char * getClassName() const
virtual const char * getName() const
Definition cobject.h:154
virtual void forEachChild(cVisitor *v)
virtual std::string getClassAndFullPath() const
virtual void parsimPack(cCommBuffer *buffer) const
virtual std::string str() const
void dropAndDelete(cOwnedObject *obj)
virtual void parsimUnpack(cCommBuffer *buffer)
virtual std::string getClassAndFullName() const
virtual cObject * dup() const
virtual bool isSoftOwner() const
Definition cobject.h:319
virtual bool isOwnedObject() const
Definition cobject.h:309
virtual std::ostream & printOn(std::ostream &os) const
virtual std::string getFullPath() const
const cObject * getThisPtr() const
Definition cobject.h:199
virtual cClassDescriptor * getDescriptor() const
A cObject that keeps track of its owner. It serves as base class for many classes in the OMNeT++ libr...
Definition cownedobject.h:106
Internal class, used as a base class for modules and channels. It is not intended for subclassing out...
Definition csoftowner.h:34
Enables traversing the tree of (cObject-rooted) simulation objects.
Definition cvisitor.h:57