00001
#if !defined(__EVENT_HPP)
00002
#define __EVENT_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#if !defined(__COMMON_HPP)
00025
#include <Common.hpp>
00026
#endif
00027
00028
namespace corelinux
00029 {
00034
template <
class IdentifierType = Identifier >
00035 class Event
00036 {
00037
public:
00038
00039
00040
00041
00043
00044 Event(
void )
00045 :
00046 theIdentifier( NULLPTR )
00047 {
00048 ;
00049 }
00050
00052
00053 Event(
const IdentifierType & aId )
00054 :
00055 theIdentifier( new IdentifierType(aId) )
00056 {
00057 ;
00058 }
00060
00061 Event(
const Event & aEvent )
00062 :
00063 theIdentifier( NULLPTR )
00064 {
00065
if( aEvent.
theIdentifier != NULLPTR )
00066 {
00067 theIdentifier =
new IdentifierType
00068 (
00069 *(aEvent.
theIdentifier)
00070 );
00071 }
00072 }
00073
00075
00076 virtual ~Event(
void )
00077 {
00078
if( theIdentifier != NULLPTR )
00079 {
00080
delete theIdentifier;
00081 theIdentifier = NULLPTR;
00082 }
00083
else
00084 {
00085 ;
00086 }
00087 }
00088
00089
00090
00091
00092
00094
00095 Event & operator=(
const Event & aEvent )
00096 {
00097
if( *
this == aEvent )
00098 {
00099 ;
00100 }
00101
else
00102 {
00103
if( theIdentifier != NULLPTR )
00104 {
00105
delete theIdentifier;
00106 theIdentifier = NULLPTR;
00107 }
00108
else
00109 {
00110 ;
00111 }
00112
00113
if( aEvent.
theIdentifier != NULLPTR )
00114 {
00115 theIdentifier =
new IdentifierType
00116 (
00117 *(aEvent.
theIdentifier)
00118 );
00119 }
00120
else
00121 {
00122 ;
00123 }
00124 }
00125
return (*this);
00126 }
00127
00129
00130 bool operator==(
const Event & aEvent )
const
00131
{
00132
bool isSame(
false );
00133
00134
if( theIdentifier != NULLPTR &&
00135 aEvent.
theIdentifier != NULLPTR )
00136 {
00137 isSame = (*theIdentifier == *(aEvent.
theIdentifier) );
00138 }
00139
else
00140 {
00141 isSame = (
this == &aEvent );
00142 }
00143
00144
return isSame;
00145 }
00146
00148
00149 operator const IdentifierType &(
void ) const
00150 throw (
NullPointerException )
00151 {
00152
if( theIdentifier == NULLPTR )
00153 {
00154
throw NullPointerException(LOCATION);
00155 }
00156
else
00157 {
00158 ;
00159 }
00160
return ( *theIdentifier );
00161 }
00162
00164
00165 operator IdentifierType *(
void ) const
00166 throw (
NullPointerException)
00167 {
00168
if( theIdentifier == NULLPTR )
00169 {
00170
throw NullPointerException(LOCATION);
00171 }
00172
else
00173 {
00174 ;
00175 }
00176
00177
return theIdentifier;
00178 }
00179
00180
protected:
00181
00182
00183
private:
00184
00185 IdentifierType *theIdentifier;
00186
00187 };
00188
00189 }
00190
00191
#endif // if !defined(__EVENT_HPP)
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201