fbplug.h

Go to the documentation of this file.
00001 #ifndef __FBPLUG_H__
00002 #define __FBPLUG_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00045 #include <kaydaradef.h>
00046 
00047 #ifndef FBSDK_DLL 
00048 
00051     #define FBSDK_DLL K_DLLIMPORT
00052 #endif
00053 
00054 // Global includes
00055 #include <object/i/icallback.h>
00056 #include <fbsdk/fbdefines.h>
00057 #include <fbsdk/fbscriptwrapper.h>
00058 #include <fbsdk/fbarray.h>
00059 
00060 #ifdef FBSDKUseNamespace
00061     namespace FBSDKNamespace {
00062 #endif
00063 
00064 
00066 // FBPlug
00068 FB_FORWARD( FBPlug );
00069 
00071 enum FBConnectionAction
00072 {
00073     // Connection notify actions
00074     kFBRequestConnectSrc = 0,
00075     kFBRequestConnectDst,   
00076     kFBConnectSrc,          
00077     kFBConnectDst,          
00078     kFBConnectedSrc,        
00079     kFBConnectedDst,        
00080 
00081     kFBRequestDisconnectSrc,
00082     kFBRequestDisconnectDst,
00083     kFBDisconnectSrc,       
00084     kFBDisconnectDst,       
00085     kFBDisconnectedSrc,     
00086     kFBDisconnectedDst,     
00087 
00088     kFBBeginReplaceSrc,     
00089     kFBEndReplaceSrc,       
00090     kFBBeginReplaceDst,     
00091     kFBEndReplaceDst,       
00092     kFBReorderSrc,          
00093     kFBReorderedSrc,        
00094 
00095     kFBBeginChange,         
00096     kFBEndChange,           
00097     kFBConnectedOwner,      
00098     kFBDisconnectOwner,     
00099 
00100     // Data notify actions
00101     kFBCandidate,           
00102     kFBCandidated,          
00103     kFBCandidateGlobal,     
00104 
00105     // State notify actions
00106     kFBDetached,            
00107     kFBDestroy,             
00108 
00109     kFBSelect,              
00110     kFBUnselect,            
00111     kFBReselect,            
00112 
00113     kFBRequestRename,       
00114     kFBRename,              
00115     kFBRenamed,             
00116 
00117     kFBRequestPrefixRename, 
00118     kFBPrefixRename,        
00119     kFBPrefixRenamed,       
00120 
00121     kFBDescription,         
00122 
00123     // Keying Notify actions
00124     kFBKeyingKey,           
00125     kFBKeyingDeleteKey,     
00126     kFBKeyingCandidate,     
00127 
00128 // for backward compatibility
00129     kFBConnect = kFBConnectSrc,
00130     kFBConnected = kFBConnectedSrc,
00131     kFBDisconnect = kFBDisconnectSrc,
00132     kFBDisconnected = kFBDisconnectedSrc
00133 };
00134 
00135 FBSDK_DLL const char* FBGetConnectionActionString( FBConnectionAction pAction );
00136 
00138 enum FBConnectionType
00139 {
00140     kFBConnectionTypeNone,          
00141     kFBConnectionTypeSystem         
00142 };
00143 
00144 enum FBPlugModificationFlag 
00145 {
00146     kFBPlugAllContent                       = 0,        
00147     kFBSelfDataModified                     = 1 << 8,   
00148     kFBContentDataModified                  = 1 << 9,   
00149     kFBAllDataModified                      = kFBSelfDataModified | kFBContentDataModified,
00150 
00151     kFBSelfKeyingModified                   = 1 << 10,  
00152     kFBContentKeyingModified                = 1 << 11,  
00153     kFBAllKeyingModified                    = kFBSelfKeyingModified | kFBContentKeyingModified,
00154 
00155     kFBSelfStateModified                    = 1 << 12,  
00156     kFBContentStateModified                 = 1 << 13,  
00157     kFBAllStateModified                     = kFBSelfStateModified | kFBContentStateModified,
00158 
00159     kFBSelfConnectionSrcObjectModified      = 1 << 14,  
00160     kFBSelfConnectionSrcPropertyModified    = 1 << 15,  
00161     kFBSelfConnectionDstObjectModified      = 1 << 16,  
00162     kFBSelfConnectionDstPropertyModified    = 1 << 17,  
00163     kFBSelfConnectionModifiedMask           = kFBSelfConnectionSrcObjectModified | kFBSelfConnectionSrcPropertyModified | kFBSelfConnectionDstObjectModified | kFBSelfConnectionDstPropertyModified,
00164     kFBContentConnectionModified            = 1 << 18,  
00165     kFBAllConnectionModified                = kFBSelfConnectionModifiedMask | kFBContentConnectionModified,
00166 
00167     kFBSelfAllModifiedMask                  = kFBSelfDataModified    | kFBSelfKeyingModified    | kFBSelfStateModified    | kFBSelfConnectionModifiedMask,
00168     kFBContentAllModifiedMask               = kFBContentDataModified | kFBContentKeyingModified | kFBContentStateModified | kFBContentConnectionModified,
00169     kFBAllModifiedMask                      = kFBSelfAllModifiedMask | kFBContentAllModifiedMask
00170 };
00171 
00173 typedef FBArrayTemplate<FBPlug*> FBPlugList;
00174 
00175 FBSDK_DLL const char* FBGetConnectionTypeString( FBConnectionType pType );
00176 
00187 class FBSDK_DLL FBPlug : public ICallback
00188                        , public FBWrapperHolder
00189 {
00190 protected:
00191 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00192 
00196     FBPlug( HIObject pObject );
00197 public:
00199     virtual ~FBPlug();
00200 
00202     virtual HIObject GetHIObject() const;
00203 
00205     virtual bool SetHIObject( HIObject pObject, bool pSDKComponent );
00206 #endif
00207 
00209     bool IsSDKComponent();
00210 
00216     bool                ConnectSrc( FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00217 
00223     bool                ConnectDst( FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00224 
00232     bool                ConnectSrcAt( int pDst_SrcIndex, FBPlug* pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00233 
00241     bool                ConnectDstAt( int pSrc_DstIndex, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00242 
00253     K_DEPRECATED bool   ConnectAt( FBPlug* pSrc, int pSrc_DstIndex, FBPlug* pDst, int pDst_SrcIndex, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00254 
00259     bool                DisconnectDst( FBPlug* pDst );
00260 
00265     bool                DisconnectSrc( FBPlug* pSrc );
00266 
00268     void                DisconnectAllSrc();
00269 
00271     void                DisconnectAllDst();
00272 
00277     bool                DisconnectDstAt( int pIndex );
00278 
00283     bool                DisconnectSrcAt( int pIndex );
00284 
00290     bool                ReplaceDstAt( int pIndex, FBPlug* pDst );
00291 
00297     bool                ReplaceSrcAt( int pIndex, FBPlug* pSrc );
00298 
00304     bool                SwapSrc( int pIndexA, int pIndexB );
00305 
00312     bool                MoveSrcAt( int pIndex, int pAtIndex );
00313 
00320     bool                MoveSrcAt( FBPlug* pSrc, FBPlug* pAtSrc );
00321 
00325     int                 GetSrcCount();
00326 
00331     FBPlug*             GetSrc( int pIndex );
00332 
00337     FBConnectionType    GetSrcType( int pIndex );
00338 
00342     int                 GetDstCount();
00343 
00348     FBPlug*             GetDst( int pIndex );
00349 
00354     FBConnectionType    GetDstType( int pIndex );
00355 
00359     bool                BeginChange();
00360 
00362     void                EndChange();
00363 
00368     void                SetSelfModified(FBPlugModificationFlag pFlag, bool pBool);
00369 
00374     bool                GetSelfModified(FBPlugModificationFlag pFlag);  
00375 
00379     void                SetContentModified(FBPlugModificationFlag pFlag, bool pBool);
00380     
00384     bool                GetContentModified(FBPlugModificationFlag pFlag);
00385 
00392     int                 GetPlugConnectionModifiedList(FBPlugList& pPlugList, FBPlugModificationFlag pConnectionModificatonFlag, bool pAddRemove);
00393 
00398     bool                RevertModification(FBPlugModificationFlag pFlag = kFBAllModifiedMask);
00399 
00403     FBPlug*             GetOwner();
00404 
00409     FBPlug*             GetOwned( int pIndex );
00410 
00414     int                 GetOwnedCount();
00415 
00417     virtual const char* ClassName();
00419 
00422     virtual bool        Is( int pTypeId );
00423 
00425 
00428     virtual int        GetTypeId();
00429 
00431     static const char* ClassGroupName;
00432 
00434     static int TypeInfo;
00435 
00437     bool            mAllocated;
00438 
00447     virtual bool PlugDataNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
00448 
00457     virtual bool PlugStateNotify(FBConnectionAction pAction,FBPlug* pThis,void* pData=NULL,void* pDataOld=NULL,int pDataSize=0);
00458 
00468     virtual bool PlugNotify(FBConnectionAction pAction,FBPlug* pThis,int pIndex,FBPlug* pPlug = NULL,FBConnectionType pConnectionType=kFBConnectionTypeNone,FBPlug* pNewPlug=NULL );
00469 
00470 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00471     IObject_Declare(Implementation);
00472     ICallback_Declare(Implementation);
00473 #endif
00474 
00475 protected:
00479     virtual void        FBDelete();
00480 
00481     static int          mGlobalTypeInfo;        
00482     static int          GetInternalClassId();   
00483     HIObject            mObject;                
00484     bool                mSDKComponent;          
00485     FBSDK_DLL friend int __FBRegisterTypeInfo(int pInternalClassId);
00486 };
00487 
00488 
00490 // Connection related utility functions.
00492 
00499 FBSDK_DLL bool FBConnect( FBPlug* pSrc, FBPlug* pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone );
00500 
00507 FBSDK_DLL bool FBDisconnect( FBPlug* pSrc, FBPlug* pDst );
00508 
00509 
00510 #ifdef FBSDKUseNamespace
00511     }
00512 #endif
00513 
00514 #endif