ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference
|
OSMetaClassBase |
Inherits from: |
class
|
Declared In: |
OSMetaClassBase is the abse class for libkern data types.
Gets the number of times this object has been retained.
Returns whether 'this' == anObj.
See OSMetaClassBase::metaCast(const OSMetaClass *).
Checks to see if this object is or inherits from the given type.
See OSMetaClassBase::metaCast(const OSMetaClass *).
See OSMetaClassBase::metaCast(const OSMetaClass *).
Disables implicit copy constructor by making private.
Disables implicit copy constructor by making private.
Releases a reference to this object.
Primary implementation of the release mechanism.
Retains a reference to this object.
Archives the receiver.
Releases a tagged reference to this object
Releases a tagged reference to this object and free if retainCount == 'when' on entry.
Retains a tagged reference to this object.
getRetainCount |
Gets the number of times this object has been retained.
public
virtual int getRetainCount() const = 0;
Returns the current retain count.
isEqualTo |
Returns whether 'this' == anObj.
public
virtual bool isEqualTo( const OSMetaClassBase *anObj) const;
anObj
Object to compare 'this' to.
Returns true if the objects are equivalent, false otherwise.
OSMetaClassBase::isEqualTo implements this as a shallow pointer comparison. The OS container classes do a more meaningful comparison. Your mileage may vary.
metaCast(const char *) |
See OSMetaClassBase::metaCast(const OSMetaClass *).
public
OSMetaClassBase *metaCast( const char *toMeta) const;
toMeta
const char * C String of the desired class' name.
Returns 'this' if the object is of the desired type, otherwise 0.
metaCast(const OSMetaClass *) |
Checks to see if this object is or inherits from the given type.
public
OSMetaClassBase *metaCast( const OSMetaClass *toMeta) const;
toMeta
Pointer to a constant OSMetaClass for the desired target type.
Returns 'this' if the object is of the desired type, otherwise 0.
This function is the guts of the OSMetaClass system. IODynamicCast, qv, is implemented using this function.
metaCast(const OSString *) |
See OSMetaClassBase::metaCast(const OSMetaClass *).
public
OSMetaClassBase *metaCast( const OSString *toMeta) const;
toMeta
OSString of the desired class' name.
Returns 'this' if the object is of the desired type, otherwise 0.
metaCast(const OSSymbol *) |
See OSMetaClassBase::metaCast(const OSMetaClass *).
public
OSMetaClassBase *metaCast( const OSSymbol *toMeta) const;
toMeta
OSSymbol of the desired class' name.
Returns 'this' if the object is of the desired type, otherwise 0.
operator = |
Disables implicit copy constructor by making private.
private
void operator =( OSMetaClassBase &src);
src
Reference to source object that isn't allowed to be copied.
OSMetaClassBase |
Disables implicit copy constructor by making private.
private
OSMetaClassBase( OSMetaClassBase &src);
src
Reference to source object that isn't allowed to be copied.
release() |
Releases a reference to this object.
public
virtual void release() const = 0;
release(int) |
Primary implementation of the release mechanism.
public
virtual void release( int when) const = 0;
when
When retainCount == 'when' then call free().
If retainCount
retain |
Retains a reference to this object.
public
virtual void retain() const = 0;
serialize |
Archives the receiver.
public
virtual bool serialize( OSSerialize *s) const = 0;
s
The OSSerialize object.
Returns true if serialization was successful, false if not.
taggedRelease(const void *) |
Releases a tagged reference to this object
public
virtual void taggedRelease( const void *tag = 0) const = 0;
taggedRelease(const void *, const int) |
Releases a tagged reference to this object and free if retainCount == 'when' on entry.
protected
virtual void taggedRelease( const void *tag, const int when) const = 0;
taggedRetain |
Retains a tagged reference to this object.
public
virtual void taggedRetain( const void *tag = 0) const = 0;
OSCheckTypeInst |
Is the target object a subclass of the reference object?
#define OSCheckTypeInst(typeinst, inst) \ OSMetaClassBase::checkTypeInst(inst, typeinst)
typeinst
Reference instance of an object, desired type.
inst
Instance of object to check for type compatibility.
false if typeinst or inst are 0 or inst is not a subclass of typeinst's class. true otherwise.
OSDynamicCast |
Roughly analogous to (type *) inst, but check if valid first.
#define OSDynamicCast(type, inst) \ ((type *) OSMetaClassBase::safeMetaCast((inst), (type::metaClass)))
type
name of desired class name. Notice that it is assumed that you desire to cast to a pointer to an object of this type. Also type qualifiers, like const, are not recognized and will cause an, usually obscure, compile error.
inst
Pointer to object that you wish to attempt to type cast. May be 0.
inst if object non-zero and it is of the desired type, otherwise 0.
OSDynamicCast is an attempt to implement a rudimentary equivalent to rtti's dynamic_cast Converts a pointer to a member function to a C-style pointer to function (note that no warnings are generated).
The type of pointer function desired. The 'this' pointer of the object whose function you wish to cache. The pointer to the member function itself, something like &Base::func. Returns a pointer to function of the given type. This function will panic if an attempt is made to call it with a multiply inherited class.
Allocate an instance of the desired object.
Name of the desired type to be created. 'this' if object cas been successfully created.
The OSTypeAlloc macro can be used to break the binary compatibility difficulties presented by new. The problem is that C++ compiles the knowledge of the size of the class into the cade calling new. If you use the alloc code however the class size is determined by the callee not the caller.
Given the name of a class return it's typeID
Name of the desired type, eg. OSObject. A unique Type ID for the class.
Given a pointer to an object return it's typeID
An instance of an OSObject subclass. The typeID, ie. OSMetaClass *.
OSMemberFunctionCast
#define OSMemberFunctionCast(cptrtype, self, func) \
(cptrtype) OSMetaClassBase:: \
_ptmf2ptf(self, (void (OSMetaClassBase::*)(void)) func)
Parameters
cptrtype
self
func
Return Value
OSTypeAlloc
#define OSTypeAlloc(type)
Parameters
type
Return Value
Discussion
OSTypeID
#define OSTypeID(type)
Parameters
type
Return Value
OSTypeIDInst
#define OSTypeIDInst(typeinst)
Parameters
typeinst
Return Value
Did this document help you?
Last Updated: 2008-12-19