ContRap-Core
Data Structures | Namespaces | Defines | Typedefs | Enumerations | Functions

pointer.h File Reference

This file contains the smart reference counting pointer implementation. More...

#include <string>
#include <map>
#include <list>
#include <iostream>
#include <typeinfo>
#include "core/error.h"
#include "core/coreexports.h"

Data Structures

class  crp::MetaInfo
 Class MetaInfo contains objects meta-information. More...
class  crp::Finalizer
 Class Finalizer is a pair of an object pointer and the corresponding destructor. More...
class  crp::DPtr
 Class DPtr is a base weak typed class for smart pointers. More...
class  crp::RefPtr
 Class RefPtr is an internal pointer class which implements the reference counter. More...
class  crp::SPtr< T >
 Class SPtr is a template typed reference counting pointer. More...

Namespaces

namespace  crp
 

The namespace crp is the namespace for all ContRap core components and libraries.


Defines

#define TYPE_ID(T)   (typeid(T).name())
 Returns the system dependent type identifier for a type.
#define SPTR(type,...)   (SPtr<type>(new type(__VA_ARGS__)))
 This macro is useful if you want to create an instance of a class, which should be wrapped by a smart pointer.

Typedefs

typedef bool(* crp::ConstructorFunction )(void *object)
 Prototype for the constructor function.
typedef bool(* crp::CopyFunction )(const void *rvalue, void *lvalue)
 Prototype for the copy function.
typedef bool(* crp::CastFunction )(const void *object)
 Prototype of cast functions.
typedef void(* crp::DestructorFunction )(const void *object)
 Prototype for the destructor function.

Enumerations

enum  crp::PointerMode {
  crp::UNDEFINED, crp::PERSISTENT, crp::INSTANT, crp::DELAYED,
  crp::SOURCE
}
 

Deletion mode enumeration type.

More...

Functions

CONTRAP_CORE_API MetaInfo * crp::get_global_meta_info (const char *type_name)
 Returns the meta info for a type.

Detailed Description

This file contains the smart reference counting pointer implementation.

This file is a part of ContRap.

Author:
Aless Lasaruk

Copyright (c) 2009-2011 by Aless Lasaruk. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of ContRap nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Define Documentation

#define SPTR (   type,
  ... 
)    (SPtr<type>(new type(__VA_ARGS__)))

This macro is useful if you want to create an instance of a class, which should be wrapped by a smart pointer.

The macro calls a constructor of the class with the given arguments and finally wraps it with a smart pointer of the same type.

Parameters:
typeType of the smart pointer to create
argumentsOne or a bracket enclosed list of arguments to the constructor of the given type
#define TYPE_ID (   T)    (typeid(T).name())

Returns the system dependent type identifier for a type.

This macro is resolved at compile time.