IParticleChannel.h

Go to the documentation of this file.
00001 
00007 /**********************************************************************
00008  *<
00009     CREATED BY: Oleg Bayborodin
00010 
00011     HISTORY: created 10-09-01
00012 
00013  *> Copyright (c) 2001, All Rights Reserved.
00014  **********************************************************************/
00015 
00016 #pragma once
00017 
00018 #include "PFExport.h"
00019 #include "..\ifnpub.h"
00020 // forward declarations
00021 class IMergeManager;
00022 
00023 // interface ID
00024 #define PARTICLECHANNEL_INTERFACE Interface_ID(0x74f93b00, 0x1eb34400)
00025 
00026 #define GetParticleChannelInterface(obj) ((IParticleChannel*)obj->GetInterface(PARTICLECHANNEL_INTERFACE))
00027 
00028 class IParticleChannel : public FPMixinInterface
00029 {
00030 public:
00031 
00032     // function IDs
00033     enum {  kClone,
00034             kIsSimilarChannel,
00035             kIsTransferable,
00036             kSetTransferable,
00037             kIsPrivateChannel,
00038             kGetPrivateOwner,
00039             kSetPrivateOwner,
00040             kGetCreatorAction,
00041             kSetCreatorAction,
00042             kGetReadID_PartA,
00043             kGetReadID_PartB,
00044             kGetWriteID_PartA,
00045             kGetWriteID_PartB,
00046             kSetReadID,
00047             kSetWriteID
00048     };
00049 
00050     // chunk IDs for saving and loading
00051     // developer: you may have your own chunk IDs
00052     // they are factored here for convenience
00053     enum {  kChunkCount         = 1000,
00054             kChunkData          = 1010,
00055             kChunkGlobalCount   = 1020,
00056             kChunkSharedCount   = 1021,
00057             kChunkGlobalValue   = 1030,
00058             kChunkSharedValue   = 1031,
00059             kChunkReadID        = 1040,
00060             kChunkWriteID       = 1050,
00061             kChunkTransferable  = 1055,
00062             kChunkPrivate       = 1056,
00063             kChunkActionHandle  = 1057,
00064             kChunkValue1        = 1061,
00065             kChunkValue2        = 1062,
00066             kChunkValue3        = 1063,
00067             kChunkValue4        = 1064,
00068             kChunkValue5        = 1065,
00069             kChunkValue6        = 1066,
00070             kChunkValue7        = 1067
00071     };
00072 
00073     // Function Map for Function Publish System
00074     //***********************************
00075     BEGIN_FUNCTION_MAP
00076 
00077     FN_0(kClone, TYPE_IOBJECT, Clone);
00078     FN_1(kIsSimilarChannel, TYPE_bool, IsSimilarChannel, TYPE_IOBJECT);
00079     FN_0(kIsTransferable, TYPE_bool, IsTransferable);
00080     VFN_1(kSetTransferable, SetTransferable, TYPE_bool);
00081     FN_0(kIsPrivateChannel, TYPE_bool, IsPrivateChannel);
00082     FN_0(kGetPrivateOwner, TYPE_OBJECT, GetPrivateOwner);
00083     VFN_1(kSetPrivateOwner, SetPrivateOwner, TYPE_OBJECT);
00084     FN_0(kGetCreatorAction, TYPE_INODE, GetCreatorAction);
00085     VFN_1(kSetCreatorAction, SetCreatorAction, TYPE_INODE);
00086     FN_0(kGetReadID_PartA, TYPE_DWORD, GetReadID_PartA);
00087     FN_0(kGetReadID_PartB, TYPE_DWORD, GetReadID_PartB);
00088     FN_0(kGetWriteID_PartA, TYPE_DWORD, GetWriteID_PartA);
00089     FN_0(kGetWriteID_PartB, TYPE_DWORD, GetWriteID_PartB);
00090     VFN_2(kSetReadID, SetReadID, TYPE_DWORD, TYPE_DWORD);
00091     VFN_2(kSetWriteID, SetWriteID, TYPE_DWORD, TYPE_DWORD);
00092 
00093     END_FUNCTION_MAP
00094 
00102     PFExport IParticleChannel();
00103 
00107     PFExport IParticleChannel(const Interface_ID& readID, const Interface_ID& writeID);
00108 
00112     virtual Class_ID GetClassID() const = 0;
00113 
00117     virtual IObject*        Clone() const = 0; 
00118 
00122     virtual IOResult Save(ISave* isave) const = 0;
00123 
00127     virtual IOResult Load(ILoad* iload) = 0;
00128 
00132     PFExport bool IsSimilarChannel(IObject* channel) const;
00133 
00137     PFExport bool IsTransferable() const;
00138 
00142     PFExport void SetTransferable(bool status);
00143 
00153     PFExport bool IsPrivateChannel() const;
00154 
00158     PFExport Object* GetPrivateOwner() const;
00159 
00163     PFExport void SetPrivateOwner(Object* action);
00164 
00169     PFExport INode* GetCreatorAction() const;
00170 
00175     PFExport void SetCreatorAction(INode* actionNode);
00176 
00180     PFExport DWORD GetReadID_PartA() const;
00181 
00185     PFExport DWORD GetReadID_PartB() const;
00186 
00190     PFExport DWORD GetWriteID_PartA() const;
00191 
00195     PFExport DWORD GetWriteID_PartB() const;
00196 
00200     PFExport void SetReadID(DWORD interfaceID_PartA, DWORD interfaceID_PartB);
00201 
00205     PFExport void SetWriteID(DWORD interfaceID_PartA, DWORD interfaceID_PartB);
00206 
00210     PFExport const Interface_ID& GetReadID() const;
00211 
00215     PFExport const Interface_ID& GetWriteID() const;
00216 
00220     PFExport void SetReadID(const Interface_ID& id);
00221 
00225     PFExport void SetWriteID(const Interface_ID& id);
00226 
00230     PFExport void CloneChannelCore(IParticleChannel* getFrom);
00231 
00236     PFExport void UpdateCreatorHandle(IMergeManager* pMM);
00237 
00241     virtual int MemoryUsed() const = 0;
00242 
00246     FPInterfaceDesc* GetDesc() { return GetDescByID(PARTICLECHANNEL_INTERFACE); }
00247 
00248 protected:
00249     bool m_isTransferable;
00250     bool m_isPrivate;
00251     mutable Object* m_privateOwner; // could be derived from creatorAction
00252     mutable INode* m_creatorAction; // could be derived from creatorHandle
00253     ULONG m_creatorHandle;
00254     // wrapper ids
00255     Interface_ID m_readID, m_writeID;
00256 
00257     int     numRefs()   const   { return m_numRefs; }
00258     int&    _numRefs()          { return m_numRefs; }
00259 private:
00260     int m_numRefs;
00261 };
00262 
00263 
00264 
00265