- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# fbxconnectionpoint.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2013 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_CORE_CONNECTION_POINT_H_
    00014 #define _FBXSDK_CORE_CONNECTION_POINT_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 #include <fbxsdk/core/base/fbxarray.h>
    00019
    00020 #include <fbxsdk/fbxsdk_nsbegin.h>
    00021
    00022 class FBXSDK_DLL FbxConnection
    00023 {
    00024 public:
    00025     enum EType
    00026     {
    00027         eNone = 0,
    00028         // System or user
    00029         eSystem = 1 << 0,
    00030         eUser = 1 << 1,
    00031         eSystemOrUser = eUser | eSystem,
    00032         // Type of Link
    00033         eReference = 1 << 2,
    00034         eContains = 1 << 3,
    00035         eData = 1 << 4,
    00036         eLinkType = eReference | eContains | eData,
    00037         eDefault = eUser | eReference,
    00038         eUnidirectional = 1 << 7
    00039     };
    00040 };
    00041
    00042 class FbxConnectionPointFilter;
    00043
    00044 class FBXSDK_DLL FbxConnectionPoint
    00045 {
    00046 public:
    00047     enum EDirection
    00048     {
    00049         eDirSrc = 1 << 0,   // Contains sources
    00050         eDirDst = 1 << 1,   // Contains destinations
    00051         eDirUni = 1 << 2,   // Connection is not 2 ways
    00052         eDirBoth = eDirSrc | eDirDst,
    00053         eDirMask = eDirSrc | eDirDst | eDirUni
    00054     };
    00055
    00056     enum EType
    00057     {
    00058         eStandard = 0,
    00059         eSubConnection = 1 << 3,        // Connect is a sub Connect of another
    00060         eTypeMask = eSubConnection
    00061     };
    00062
    00063     enum EAttribute
    00064     {
    00065         eDefault = 0,
    00066         eCache = 1 << 4,
    00067         eAttributeMask = eCache
    00068     };
    00069
    00070     enum EAllocFlag
    00071     {
    00072         eNotAllocated = 0,
    00073         eAllocated = 1 << 5,
    00074         eAllocFlagMask = eAllocated
    00075     };
    00076
    00077     enum ECleanedFlag
    00078     {
    00079         eNotCleaned = 0,
    00080         eCleaned = 1 << 6,
    00081         eCleanedFlagMask = eCleaned
    00082     };
    00083
    00084     enum EEvent
    00085     {
    00086         eSrcConnectRequest,
    00087         eDstConnectRequest,
    00088         eSrcConnect,
    00089         eDstConnect,
    00090         eSrcConnected,
    00091         eDstConnected,
    00092         eSrcDisconnect,
    00093         eDstDisconnect,
    00094         eSrcDisconnected,
    00095         eDstDisconnected,
    00096         eSrcReplaceBegin,
    00097         eSrcReplaceEnd,
    00098         eDstReplaceBegin,
    00099         eDstReplaceEnd,
    00100         eSrcReorder,
    00101         eSrcReordered
    00102     };
    00103
    00104     // Constructor/Destructor
    00105     FbxConnectionPoint(void* pData=0);
    00106     virtual ~FbxConnectionPoint();
    00107
    00108     void SetFilter(FbxConnectionPointFilter* pConnectFilter, EType pType=eStandard);
    00109     void InternalClear();
    00110
    00112     void WipeConnectionList();
    00113     void Destroy();
    00114     void SubConnectRemoveAll();
    00115
    00116     inline FbxConnectionPoint*          GetSubOwnerConnect(){ return GetConnectType() == eSubConnection ? mOwner : NULL; }
    00117     inline FbxConnectionPointFilter*    GetFilter(){ return mFilter; }
    00118
    00119     virtual bool        IsInReplace(FbxConnectionPoint* p1, FbxConnectionPoint* p2);
    00120
    00121     inline void         SetConnectType(EType pType){ mFlags = (mFlags & ~eTypeMask) | pType; }
    00122     inline EType        GetConnectType(){ return EType(mFlags & eTypeMask); }
    00123     inline void         SetDirection(int pDirections){ mFlags = (mFlags & ~eDirMask) | pDirections; }
    00124     inline EDirection   GetDirection(){ return EDirection(mFlags & eDirMask); }
    00125     inline void         SetAttribute(int pAttributes){ mFlags = (mFlags & ~eAttributeMask) | pAttributes; }
    00126     inline EAttribute   GetAttribute(){ return EAttribute(mFlags & eAttributeMask); }
    00127     inline void         SetAllocatedFlag(bool pBool){ mFlags = ( pBool ) ? mFlags | eAllocated : mFlags & ~eAllocFlagMask; }
    00128     inline bool         GetAllocatedFlag(){ return ( mFlags & eAllocFlagMask ) ? true : false; }
    00129     inline void         SetCleanedFlag(bool pBool){ mFlags = ( pBool ) ? mFlags | eCleaned : mFlags & ~eCleanedFlagMask; }
    00130     inline bool         GetCleanedFlag(){ return ( mFlags & eCleanedFlagMask ) ? true : false; }
    00131
    00132     bool                IsValidSrc(FbxConnectionPoint* pConnect);
    00133     bool                IsValidDst(FbxConnectionPoint* pConnect);
    00134     bool                IsValidSrcConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType);
    00135     bool                IsValidDstConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType);
    00136     bool                RequestValidSrcConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType );
    00137     bool                RequestValidDstConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType );
    00138
    00139     bool                ConnectSrc(FbxConnectionPoint* pSrc,FbxConnection::EType pConnectionType=FbxConnection::eNone);
    00140     bool                ConnectDst(FbxConnectionPoint* pDst,FbxConnection::EType pConnectionType=FbxConnection::eNone);
    00141     bool                ConnectSrcAt(int pDst_SrcIndex, FbxConnectionPoint* pSrc, FbxConnection::EType pConnectionType=FbxConnection::eNone);
    00142     bool                ConnectDstAt(int pSrc_DstIndex, FbxConnectionPoint* pDst, FbxConnection::EType pConnectionType=FbxConnection::eNone);
    00143     static bool         ConnectConnect(FbxConnectionPoint* pSrc,FbxConnectionPoint* pDst,FbxConnection::EType pConnectionType);
    00144     static bool         ConnectAt(FbxConnectionPoint* pSrc, int pSrc_DstIndex, FbxConnectionPoint* pDst, int pDst_SrcIndex, FbxConnection::EType pConnectionType);
    00145
    00146     bool                DisconnectDst(FbxConnectionPoint* pSrc);
    00147     bool                DisconnectSrc(FbxConnectionPoint* pSrc);
    00148     void                DisconnectAllSrc();
    00149     void                DisconnectAllDst();
    00150     static bool         DisconnectConnect(FbxConnectionPoint* pSrc,FbxConnectionPoint* pDst);
    00151     bool                DisconnectDstAt(int pIndex);
    00152     bool                DisconnectSrcAt(int pIndex);
    00153
    00154     bool                ReplaceInDst(FbxConnectionPoint* pDstOld, FbxConnectionPoint* pDstNew, int pIndexInNew);
    00155     bool                ReplaceInSrc(FbxConnectionPoint* pSrcOld, FbxConnectionPoint* pSrcNew, int pIndexInNew);
    00156     bool                ReplaceDstAt(int pIndex, FbxConnectionPoint* pDst);
    00157     bool                ReplaceSrcAt(int pIndex, FbxConnectionPoint* pSrc);
    00158     bool                SwapSrc(int pIndexA, int pIndexB);
    00159
    00166     bool MoveSrcAt(int pIndex, int pAtIndex);
    00167
    00174     bool MoveSrcAt(FbxConnectionPoint* pSrc, FbxConnectionPoint* pAtSrc);
    00175
    00176     // Access services
    00177     bool IsConnectedSrc(FbxConnectionPoint*);
    00178     bool IsConnectedDst(FbxConnectionPoint*);
    00179     inline bool IsConnected(FbxConnectionPoint* pConnect) { return IsConnectedSrc(pConnect) || IsConnectedDst(pConnect); }
    00180
    00181     inline int                  GetSrcCount() const { return mConnectionList.GetSrcCount(); }
    00182     inline FbxConnectionPoint*  GetSrc(int pIndex) const { return mConnectionList.GetSrc(pIndex);}
    00183     inline FbxConnection::EType GetSrcType(int pIndex) const { return mConnectionList.GetSrcType(pIndex);}
    00184     inline int                  GetDstCount() const { return mConnectionList.GetDstCount(); }
    00185     inline FbxConnectionPoint*  GetDst(int pIndex) const { return mConnectionList.GetDst(pIndex);}
    00186     inline FbxConnection::EType GetDstType(int pIndex) const { return mConnectionList.GetDstType(pIndex);}
    00187
    00188     inline int                  FindSrc(FbxConnectionPoint* pConnect){ return mConnectionList.FindSrc(pConnect); }
    00189     inline int                  FindDst(FbxConnectionPoint* pConnect){ return mConnectionList.FindDst(pConnect); }
    00190
    00191     // Filtered versions
    00192     inline int                  GetSrcCount(FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrcCount() : GetSrcCount(); }
    00193     inline FbxConnectionPoint*  GetSrc(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrc(pIndex) : GetSrc(pIndex); }
    00194     inline FbxConnection::EType GetSrcType(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetSrcType(pIndex) : GetSrcType(pIndex); }
    00195     inline int                  GetDstCount(FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDstCount() : GetDstCount(); }
    00196     inline FbxConnectionPoint*  GetDst(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDst(pIndex): GetDst(pIndex); }
    00197     inline FbxConnection::EType GetDstType(int pIndex,FbxConnectionPointFilter* pFilter){ return (pFilter) ? SubConnectGetOrCreate(pFilter)->GetDstType(pIndex) : GetDstType(pIndex); }
    00198
    00199     void* GetData(){ return mData; }
    00200
    00201 /*****************************************************************************************************************************
    00202 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
    00203 *****************************************************************************************************************************/
    00204 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00205 protected:
    00206     class ConnectionList
    00207     {
    00208     public:
    00209         ConnectionList();
    00210         ~ConnectionList();
    00211
    00212         void                    Clear();
    00213
    00214         void                    InsertSrcAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pType);
    00215         void                    AddSrc(FbxConnectionPoint* pConnect, FbxConnection::EType pType);
    00216         void                    RemoveSrcAt(int pIndex);
    00217         int                     FindSrc(FbxConnectionPoint* pConnect) const;
    00218         int                     GetSrcCount() const;
    00219         FbxConnectionPoint*     GetSrc(int pIndex) const;
    00220         FbxConnection::EType    GetSrcType(int pIndex) const;
    00221
    00222         void                    InsertDstAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pType);
    00223         void                    AddDst(FbxConnectionPoint* pConnect, FbxConnection::EType pType);
    00224         void                    RemoveDstAt(int pIndex);
    00225         int                     FindDst(FbxConnectionPoint* pConnect) const;
    00226         int                     GetDstCount() const;
    00227         FbxConnectionPoint*     GetDst(int pIndex) const;
    00228         FbxConnection::EType    GetDstType(int pIndex) const;
    00229
    00230     protected:
    00231         struct Connection {
    00232             Connection(FbxConnectionPoint* pPoint, FbxConnection::EType pType) : mPoint(pPoint), mType(pType){}
    00233             FbxConnectionPoint* mPoint; FbxConnection::EType mType;
    00234         };
    00235         FbxArray<Connection>    mSrcList;
    00236         FbxArray<Connection>    mDstList;
    00237     };
    00238
    00239     void                SubConnectAdd(FbxConnectionPoint* pConnect);
    00240     void                SubConnectRemove(FbxConnectionPoint* pConnect);
    00241     FbxConnectionPoint* SubConnectFind(FbxConnectionPointFilter* pFilter);
    00242     FbxConnectionPoint* SubConnectGetOrCreate(FbxConnectionPointFilter* pFilter);
    00243     void                SubConnectFill(FbxConnectionPoint*  pConnect);
    00244
    00245     virtual bool        ConnectNotify(EEvent pAction, FbxConnectionPoint* pThis, int pIndex, FbxConnectionPoint* pConnect=NULL, FbxConnection::EType pConnectionType=FbxConnection::eNone, FbxConnectionPoint* pNewConnect=NULL);
    00246     virtual void        ConnectCleanUp(FbxConnectionPoint* pThis);
    00247
    00248     int                 FindSrcIndexFromOwnerConnectIndex(FbxConnectionPoint* pOwner, int pOwnerIndex);
    00249     int                 FindDstIndexFromOwnerConnectIndex(FbxConnectionPoint* pOwner, int pOwnerIndex);
    00250
    00251     bool                InternalMoveSrcBefore(int pIndex, int pBeforeIndex);
    00252
    00253 private:
    00254     inline void         InsertSrcAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType){ mConnectionList.InsertSrcAt(pIndex, pConnect, pConnectionType); }
    00255     inline void         InsertDstAt(int pIndex, FbxConnectionPoint* pConnect, FbxConnection::EType pConnectionType){ mConnectionList.InsertDstAt(pIndex, pConnect, pConnectionType); }
    00256     inline void         RemoveSrcAt(int pIndex){ mConnectionList.RemoveSrcAt(pIndex); }
    00257     inline void         RemoveDstAt(int pIndex){ mConnectionList.RemoveDstAt(pIndex); }
    00258
    00259     static bool         InternalConnectBefore(FbxConnectionPoint* pSrc, FbxConnectionPoint* pSrc_BeforeDst, FbxConnectionPoint* pDst, FbxConnectionPoint* pDst_BeforeSrc, FbxConnection::EType pConnectionType);
    00260     static bool         UserConnectBefore(FbxConnectionPoint* pSrc, FbxConnectionPoint* pSrc_BeforeDst, FbxConnectionPoint* pDst, FbxConnectionPoint* pDst_BeforeSrc, FbxConnection::EType pConnectionType);
    00261     static bool         EmitReplaceNotify(FbxConnectionPoint* pDstOwner, FbxConnectionPoint* pSrcOwner, FbxConnectionPoint* pDst, FbxConnectionPoint* pSrc, EEvent pConnectAction, FbxConnectionPoint* pNew);
    00262
    00263     virtual bool                SetOwnerConnect(FbxConnectionPoint* pConnect);
    00264     inline FbxConnectionPoint*  GetOwnerConnect(){ return mOwner;  }
    00265     bool                        ConnectOwnedConnect(FbxConnectionPoint* pConnect);
    00266     bool                        DisconnectOwnedConnect(FbxConnectionPoint* pConnect);
    00267
    00268     void*                           mData;
    00269     int                             mFlags;
    00270     FbxConnectionPoint*             mOwner;
    00271     ConnectionList                  mConnectionList;
    00272     FbxArray<FbxConnectionPoint*>   mSubConnectList;
    00273     FbxArray<FbxConnectionPoint*>   mSubConnectCreatedList;
    00274     FbxConnectionPointFilter*       mFilter;
    00275 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
    00276 };
    00277
    00279 class FBXSDK_DLL FbxConnectionPointFilter
    00280 {
    00281 public:
    00282     virtual ~FbxConnectionPointFilter() {};
    00283
    00285     virtual FbxConnectionPointFilter* Ref();
    00286
    00288     virtual void Unref();
    00289
    00291     virtual FbxInt GetUniqueId() const { return 0; }
    00292
    00296     virtual bool IsValid(FbxConnectionPoint* pConnect) const;
    00297
    00302     virtual bool IsValidConnection(FbxConnectionPoint* pConnect, FbxConnection::EType pType) const;
    00303
    00307     virtual bool IsEqual(FbxConnectionPointFilter* pConnectFilter) const;
    00308 };
    00309
    00310 #include <fbxsdk/fbxsdk_nsend.h>
    00311
    00312 #endif /* _FBXSDK_CORE_CONNECTION_POINT_H_ */