Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RTTI macros for Object also #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions include/mitsuba/core/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class MTS_EXPORT_CORE Object {
*/
void decRef(bool autoDeallocate = true) const;

/// Retrieve this object's class
virtual const Class *getClass() const;

/**
* \brief Return a human-readable string representation
* of the object's contents.
Expand All @@ -77,13 +74,13 @@ class MTS_EXPORT_CORE Object {

/// Free the memory taken by staticInitialization()
static void staticShutdown();

MTS_DECLARE_CLASS()
protected:
/** \brief Virtual private deconstructor.
* (Will only be called by \ref ref)
*/
virtual ~Object();
public:
static Class *m_theClass; ///< Pointer to the object's class descriptor
private:
#if !defined(_MSC_VER)
volatile mutable int m_refCount;
Expand Down
7 changes: 1 addition & 6 deletions src/libcore/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ static RefCountTracker *__ref_tracker = NULL;
} // namespace
#endif

Class *MTS_CLASS(Object) = new Class("Object", false, "");

Object::Object()
: m_refCount(0) {
#if DEBUG_REFCOUNTS == 1
Expand Down Expand Up @@ -126,10 +124,6 @@ void Object::decRef(bool autoDeallocate) const {
}
}

const Class *Object::getClass() const {
return m_theClass;
}

std::string Object::toString() const {
std::ostringstream oss;
oss << getClass()->getName();
Expand Down Expand Up @@ -160,4 +154,5 @@ void Object::staticShutdown() {
#endif
}

MTS_IMPLEMENT_CLASS(Object, false, )
MTS_NAMESPACE_END