35 #ifndef __INTERFACEFACTORY__ 36 #define __INTERFACEFACTORY__ 39 #include "OMFactoryCtor.h" 64 @param faceID The ID of the implementation
65 @param faceFact The factory
function for constructing the implementation.
66 @param faceDestroy The
function for destructing the implementation.
67 @param faceSizeOf The
function for getting the
sizeof the implementation.
68 @param faceReadWrite The ReadWrite
function for the implementation (optional)
69 @param faceSnapshotReadWrite The Snapshot
function for the implementation (optional)
70 @param faceRestVIewFun The ResetView
function for the implementation (optional)
73 InterfaceConstructor faceFact,
74 InterfaceDestructor faceDestroy,
75 InterfaceSizeOf faceSizeOf,
76 InterfaceReadWrite faceReadWrite = nil,
77 InterfaceReadWrite faceSnapshotReadWrite = nil,
78 InterfaceResetViewFun resetViewFun = nil);
84 static void InstallInterfaces(
PluginID ownerComponent);
87 const InterfaceConstructor GetFactory() {
return fFactory; }
88 const InterfaceDestructor GetDestructor() {
return fDestructor; }
89 const InterfaceSizeOf GetSizeOf() {
return fSizeOf; }
90 const InterfaceReadWrite GetReadWrite() {
return fReadWrite; }
91 const InterfaceReadWrite GetSnapshotReadWrite() {
return fSnapshotReadWrite; }
92 const InterfaceResetViewFun GetInterfaceResetViewFun() {
return fInterfaceResetViewFun;}
99 const InterfaceConstructor fFactory;
100 const InterfaceDestructor fDestructor;
101 const InterfaceSizeOf fSizeOf;
102 const InterfaceReadWrite fReadWrite;
103 const InterfaceReadWrite fSnapshotReadWrite;
104 const InterfaceResetViewFun fInterfaceResetViewFun;
120 #ifdef USE_ALLOCATE_WITH_BOSS 121 #define PRIVATE_DECLARE_PMINTERFACE(idstring) \ 122 extern "C" { void* Create##idstring(void *memoryBuffer, IPMUnknown *boss); \ 123 void Destroy##idstring(void *facePtr); \ 124 int SizeOf##idstring(); } 126 #define PRIVATE_DECLARE_PMINTERFACE(idstring) \ 127 extern "C" { void* Create##idstring(IPMUnknown *boss); \ 128 void Destroy##idstring(void *facePtr); \ 129 int SizeOf##idstring(); } 134 #define PRIVATE_HACK_PMINTERFACE(idstring) \ 135 InterfaceFactory *Get##idstring##InterfaceFactory(); \ 136 InterfaceFactory *Get##idstring##InterfaceFactory() { return &g##idstring##Factory; } 139 #ifdef USE_ALLOCATE_WITH_BOSS 140 #define PRIVATE_DEFINE_PMINTERFACE(cn, idstring) \ 141 extern "C" { void* Create##idstring(void *memoryBuffer, IPMUnknown *boss) \ 143 return new (memoryBuffer) cn(boss); \ 145 void Destroy##idstring(void *facePtr) \ 146 { reinterpret_cast<cn*>(facePtr)->~cn(); } \ 147 int SizeOf##idstring() \ 148 { return sizeof (cn); } } 150 #define PRIVATE_DEFINE_PMINTERFACE(cn, idstring) \ 151 extern "C" { void* Create##idstring(IPMUnknown *boss) \ 153 return new cn(boss); \ 155 void Destroy##idstring(void *facePtr) \ 156 { delete reinterpret_cast<cn*>(facePtr); } \ 157 int SizeOf##idstring() \ 158 { return sizeof (cn); } } 164 #ifdef USE_ALLOCATE_WITH_BOSS 165 #define PRIVATE_DEFINE_VIEWINTERFACE(id, cn, idstring) \ 166 extern "C" { void* Create##idstring(void *memoryBuffer, IPMUnknown *boss) \ 168 cn* face = new (memoryBuffer) cn(boss); \ 172 face->fViewIFaceConsistencyChecker = nil;\ 175 void Destroy##idstring(void *facePtr) \ 176 { reinterpret_cast<cn*>(facePtr)->~cn(); } \ 177 int SizeOf##idstring() \ 178 { return sizeof (cn); } } 180 #define PRIVATE_DEFINE_VIEWINTERFACE(id, cn, idstring) \ 181 extern "C" { void* Create##idstring(IPMUnknown *boss) \ 183 cn* face = new cn(boss); \ 187 face->fViewIFaceConsistencyChecker = nil;\ 190 void Destroy##idstring(void *facePtr) \ 191 { delete reinterpret_cast<cn*>(facePtr); } \ 192 int SizeOf##idstring() \ 193 { return sizeof (cn); } } 196 #ifdef USE_ALLOCATE_WITH_BOSS 197 #define PRIVATE_DEFINE_PERSIST_DONTSNAPSHOT_PMINTERFACE(cn, idstring) \ 198 extern "C" { void* Create##idstring(void *memoryBuffer, IPMUnknown *boss) \ 200 cn* face = new (memoryBuffer) cn(boss); \ 204 face->fDontSnapshotIFaceConsistencyChecker = nil;\ 207 void Destroy##idstring(void *facePtr) \ 208 { reinterpret_cast<cn*>(facePtr)->~cn(); } \ 209 int SizeOf##idstring() \ 210 { return sizeof (cn); } } 212 #define PRIVATE_DEFINE_PERSIST_DONTSNAPSHOT_PMINTERFACE(cn, idstring) \ 213 extern "C" { void* Create##idstring(IPMUnknown *boss) \ 215 cn* face = new cn(boss); \ 219 face->fDontSnapshotIFaceConsistencyChecker = nil;\ 222 void Destroy##idstring(void *facePtr) \ 223 { delete reinterpret_cast<cn*>(facePtr); } \ 224 int SizeOf##idstring() \ 225 { return sizeof (cn); } } 229 static InterfaceFactory g##idstring##Factory(
id, Create##idstring, (InterfaceDestructor)Destroy##idstring, (InterfaceSizeOf)SizeOf##idstring);
232 #define PRIVATE_DECLARE_READWRITE(cn, idstring) \ 233 void ReadWrite##idstring(cn *obj, IPMStream *s, ImplementationID prop, int32 length); 236 #define PRIVATE_DECLARE_SNAPSHOTREADWRITE(cn, idstring) \ 237 void SnapshotReadWrite##idstring(cn *obj, IPMStream *s, ImplementationID prop, int32 length); 240 #define PRIVATE_DECLARE_RESETVIEWFUN(cn, idstring) \ 241 void ResetViewFun##idstring(cn *obj, ImplementationID prop); 244 #define PRIVATE_DEFINE_READWRITE(cn, idstring) \ 245 void ReadWrite##idstring(cn *obj, IPMStream *s, ImplementationID prop, int32 ) \ 246 { obj->ReadWrite(s, prop); } 249 #define PRIVATE_DEFINE_SNAPSHOTREADWRITE(cn, idstring) \ 250 void SnapshotReadWrite##idstring(cn *obj, IPMStream *s, ImplementationID prop, int32 ) \ 251 { obj->SnapshotReadWrite(s, prop); } 254 #define PRIVATE_DEFINE_RESETVIEWFUN(cn, idstring) \ 255 void ResetViewFun##idstring(cn *obj, ImplementationID prop) \ 256 { obj->ResetView(prop); } 259 #define PRIVATE_REGISTER_PERSIST_PMINTERFACE(id, idstring) \ 260 static InterfaceFactory g##idstring##Factory(id, Create##idstring, (InterfaceDestructor)Destroy##idstring, (InterfaceSizeOf)SizeOf##idstring, (InterfaceReadWrite)ReadWrite##idstring, (InterfaceReadWrite)nil, (InterfaceResetViewFun)nil); 262 #define PRIVATE_REGISTER_PERSIST_SNAPSHOT_PMINTERFACE(id, idstring) \ 263 static InterfaceFactory g##idstring##Factory(id, Create##idstring, (InterfaceDestructor)Destroy##idstring, (InterfaceSizeOf)SizeOf##idstring, (InterfaceReadWrite)ReadWrite##idstring, (InterfaceReadWrite)SnapshotReadWrite##idstring, (InterfaceResetViewFun)nil); 265 #define PRIVATE_REGISTER_SNAPSHOT_PMINTERFACE(id, idstring) \ 266 static InterfaceFactory g##idstring##Factory(id, Create##idstring, (InterfaceDestructor)Destroy##idstring, (InterfaceSizeOf)SizeOf##idstring, (InterfaceReadWrite) nil, (InterfaceReadWrite)SnapshotReadWrite##idstring, (InterfaceResetViewFun)nil); 268 #define PRIVATE_REGISTER_VIEW_PMINTERFACE(id, idstring) \ 269 static InterfaceFactory g##idstring##Factory(id, Create##idstring, (InterfaceDestructor)Destroy##idstring, (InterfaceSizeOf)SizeOf##idstring, (InterfaceReadWrite) nil, (InterfaceReadWrite)SnapshotReadWrite##idstring, (InterfaceResetViewFun)ResetViewFun##idstring); 271 #define BUILD_PMINTERFACE(idstring) \ 272 InterfaceFactory *Get##idstring##InterfaceFactory(); \ 273 Get##idstring##InterfaceFactory(); 277 XXXFactory.h file which has declarations
for the implementations it contains.
278 @param cn C++
class used for the implementation
284 BUILD_PMINTERFACE(
id##_)
291 #define REFERENCE_PMINTERFACE(id) \ 292 BUILD_PMINTERFACE(id##_) 296 This is the
default way to declare your implementation.
297 @param cn C++
class used for the implementation
300 PRIVATE_DECLARE_PMINTERFACE(
id##_) \
301 PRIVATE_DEFINE_PMINTERFACE(cn,
id##_) \
302 PRIVATE_HACK_PMINTERFACE(
id##_)
304 object model. Use
this if your implementation has a ReadWrite method.
305 @param cn C++
class used for the implementation
308 PRIVATE_DECLARE_PMINTERFACE(
id##_) \
309 PRIVATE_DECLARE_READWRITE(cn,
id##_) \
310 PRIVATE_DEFINE_PMINTERFACE(cn,
id##_) \
311 PRIVATE_DEFINE_READWRITE(cn,
id##_) \
312 PRIVATE_REGISTER_PERSIST_PMINTERFACE(
id,
id##_) \
313 PRIVATE_HACK_PMINTERFACE(
id##_)
320 #define CREATE_PERSIST_SNAPSHOT_PMINTERFACE(cn, id) \ 321 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 322 PRIVATE_DECLARE_READWRITE(cn, id##_) \ 323 PRIVATE_DECLARE_SNAPSHOTREADWRITE(cn, id##_) \ 324 PRIVATE_DEFINE_PMINTERFACE(cn, id##_) \ 325 PRIVATE_DEFINE_READWRITE(cn, id##_) \ 326 PRIVATE_DEFINE_SNAPSHOTREADWRITE(cn, id##_) \ 327 PRIVATE_REGISTER_PERSIST_SNAPSHOT_PMINTERFACE(id, id##_) \ 328 PRIVATE_HACK_PMINTERFACE(id##_) 335 #define CREATE_SNAPSHOT_PMINTERFACE(cn, id) \ 336 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 337 PRIVATE_DECLARE_SNAPSHOTREADWRITE(cn, id##_) \ 338 PRIVATE_DEFINE_PMINTERFACE(cn, id##_) \ 339 PRIVATE_DEFINE_SNAPSHOTREADWRITE(cn, id##_) \ 340 PRIVATE_REGISTER_SNAPSHOT_PMINTERFACE(id, id##_) \ 341 PRIVATE_HACK_PMINTERFACE(id##_) 348 #define CREATE_VIEW_PMINTERFACE(cn, id) \ 349 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 350 PRIVATE_DECLARE_SNAPSHOTREADWRITE(cn, id##_) \ 351 PRIVATE_DECLARE_RESETVIEWFUN(cn, id##_) \ 352 PRIVATE_DEFINE_VIEWINTERFACE(id, cn, id##_) \ 353 PRIVATE_DEFINE_SNAPSHOTREADWRITE(cn, id##_) \ 354 PRIVATE_DEFINE_RESETVIEWFUN(cn, id##_) \ 355 PRIVATE_REGISTER_VIEW_PMINTERFACE(id, id##_) \ 356 PRIVATE_HACK_PMINTERFACE(id##_) 362 #define EXPORT_PMINTERFACE(cn, id) \ 363 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 364 PRIVATE_DEFINE_PMINTERFACE(cn, id##_) 366 #define IMPORT_PMINTERFACE(cn, id) \ 367 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 368 PRIVATE_HACK_PMINTERFACE(id##_) 379 #define CREATE_PERSIST_DONTSNAPSHOT_PMINTERFACE(cn, id) \ 380 PRIVATE_DECLARE_PMINTERFACE(id##_) \ 381 PRIVATE_DECLARE_READWRITE(cn, id##_) \ 382 PRIVATE_DEFINE_PERSIST_DONTSNAPSHOT_PMINTERFACE(cn, id##_) \ 383 PRIVATE_DEFINE_READWRITE(cn, id##_) \ 384 PRIVATE_REGISTER_PERSIST_PMINTERFACE(id, id##_) \ 385 PRIVATE_HACK_PMINTERFACE(id##_) 386 #endif // __INTERFACEFACTORY__