Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
fieldvalueptr.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 # ifndef OPENVRML_FIELDVALUEPTR_H
00022 # define OPENVRML_FIELDVALUEPTR_H
00023
00024 # include <stddef.h>
00025 # include <assert.h>
00026 # include "common.h"
00027
00028 namespace OpenVRML {
00029
00030 class FieldValue;
00031
00032 class OPENVRML_SCOPE FieldValuePtr {
00033 FieldValue * fieldValue;
00034 size_t * count;
00035
00036 public:
00037 explicit FieldValuePtr(FieldValue * fieldValue = 0);
00038 FieldValuePtr(const FieldValuePtr & fieldValuePtr);
00039 ~FieldValuePtr();
00040
00041 operator bool() const;
00042
00043 FieldValuePtr & operator=(const FieldValuePtr & fieldValuePtr);
00044
00045 bool operator==(const FieldValuePtr & fieldValuePtr) const;
00046
00047 FieldValue & operator*() const;
00048 FieldValue * operator->() const;
00049 FieldValue * get() const;
00050
00051 void reset(FieldValue * fieldValue = 0);
00052
00053 private:
00054 void dispose();
00055 };
00056
00057 inline FieldValuePtr::~FieldValuePtr() {
00058 this->dispose();
00059 }
00060
00061 inline FieldValuePtr::operator bool() const {
00062 return this->fieldValue;
00063 }
00064
00065 inline bool FieldValuePtr::operator==(const FieldValuePtr & fieldValuePtr) const {
00066 return (this->fieldValue == fieldValuePtr.fieldValue);
00067 }
00068
00069 inline FieldValue & FieldValuePtr::operator*() const {
00070 assert(this->fieldValue);
00071 return *this->fieldValue;
00072 }
00073
00074 inline FieldValue * FieldValuePtr::operator->() const {
00075 assert(this->fieldValue);
00076 return this->fieldValue;
00077 }
00078
00079 inline FieldValue * FieldValuePtr::get() const {
00080 assert(this->fieldValue);
00081 return this->fieldValue;
00082 }
00083 }
00084
00085 # endif