Advertisement
Guest User

Untitled

a guest
Jul 28th, 2011
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.56 KB | None | 0 0
  1. /////////////////////////////////////////////////////////////////////////////
  2. // EuProcessor.h
  3. //
  4. // Copyright (C) 2003-2010 Euphonix, Inc.
  5. // This source code is licensed under the EuCon SDK License Agreement.
  6. // All rights reserved.
  7. //
  8. // Date:        Tuesday, January 27, 2004
  9. // Author:      PCAMPBELL
  10. // Description: Base class for EuCon processor units
  11. /////////////////////////////////////////////////////////////////////////////
  12.  
  13. #if !defined(__EUPHONIX_EUPROCESSOR_H__)
  14. #define __EUPHONIX_EUPROCESSOR_H__
  15.  
  16. #include "EuDefinitions.h"
  17. #include "EuCommon.h"
  18.  
  19. #include <vector>
  20.  
  21. class EuControl;
  22. class EuPrimitiveControl;
  23. class EuSurfaceBrowser;
  24. class EuProcessorBrowser;
  25. class EuNode;
  26.  
  27. class EUAPI_CLASS  EuProcessor : public EuCommon
  28. {
  29. public:
  30.  
  31.     // constructor and initialization methods
  32.     EUAPI_FUNC EuProcessor();
  33.     virtual EUAPI_FUNC ~EuProcessor();
  34.  
  35.     // These methods are used in creating a new EuProcessor-derived class
  36.  
  37.     EUAPI_FUNC tERR SetLabel(tEuString& i4Char, tEuString& i8Char, tEuString& iLong);
  38.  
  39.     EUAPI_FUNC tERR AddControl(EuControl& iControl);
  40.     EUAPI_FUNC tERR RemoveControl(EuControl& iControl);
  41.     EUAPI_FUNC tERR GetContainedControls(std::vector<EuControl*>& oControls) const;
  42.  
  43.     EUAPI_FUNC tERR AddProcessor(EuProcessor& iProcessor);
  44.     EUAPI_FUNC tERR GetContainedProcessors (std::vector<EuProcessor*>& oProcessors) const;
  45.  
  46.     // *oppParentProcessor will be null if no parent; if so, then call GetParent( EuNode ), below
  47.     EUAPI_FUNC tERR GetParent( EuProcessor** oppParentProcessor ) const;  
  48.     EUAPI_FUNC tERR GetParent( EuNode** oppParentEuNode ) const;  // *oppParentEuNode will be null if parent not an EuNode
  49.  
  50.     ////////////////////////////////////////////////////////////////////////////////////////////////
  51.     //
  52.     //  To avoid a race condition, two callbacks are provided: OnConfirmValueCallback() and OnCallback().
  53.     //
  54.     //  The first callback (OnConfirmValueCallback) provides the model a way to confirm or change the
  55.     //  requested index (ioRequestedNewIndex); deciding if this is necessary is up to the modeler.  
  56.     //
  57.     //  Confirming or altering the requested index is the only operation that should be performed in
  58.     //  OnConfirmValueCallback(); otherwise a race condition can occur, as the control is still set to
  59.     //  the old index, and is waiting for OnConfirmValueCallback to return with the confirmed new value.
  60.     //
  61.     //  OnConfirmValueCallback() is not called by default.  To enable OnConfirmValueCallback, invoke
  62.     //  MakeConfirmationCallback( bool ) in each Primitive Control you wish to enable it for (see
  63.     //  EuPrimitiveControl.h):
  64.     //
  65.     //      MakeConfirmationCallback( true );  // default is false:  OnConfirmValueCallback() is not called.
  66.     //
  67.     //  (Note that OnConfirmValueCallback() must be overloaded by the derived EuProcessor class whether it
  68.     //  is to be called or not.)
  69.     //
  70.     //  Also, if the modeler decides no confirmation is needed for certain controls, the processor can
  71.     //  simply return from OnConfirmValueCallback() without handling all cases, and ioRequestedNewIndex
  72.     //  will be used unchanged as the new index for any unhandled cases.
  73.     //
  74.     //  When OnConfirmValueCallback() returns, the internal EuProcessor code will update the control to
  75.     //  the new index (ioRequestedNewIndex).  It will then immediately make the second callback (OnCallback),
  76.     //  where the real work is done by the processor.  
  77.     //
  78.     ////////////////////////////////////////////////////////////////////////////////////////////////
  79.  
  80.    
  81.  
  82.     /////////////////////////////////////////////////////////////////////////////////////////////////
  83.     //
  84.     // This method must be overloaded in the derived class.
  85.     //
  86.     // If desired, modify the new value (ioRequestedNewIndex) requested by the surface.
  87.     //
  88.     virtual EUAPI_FUNC void OnConfirmValueCallback( NEuCon::uint32         iEventFlags,
  89.                                                     NEuCon::uint32         iControlId,
  90.                                                     NEuCon::uint32         iArrayMemberControlId,
  91.                                                     NEuCon::uint32         iPrimitiveId,   
  92.                                                     EuPrimitiveControl*    iAffectedPrimitive,
  93.                                                     NEuCon::uint16&        ioRequestedNewValueIndex  );
  94.  
  95.  
  96.  
  97.     /////////////////////////////////////////////////////////////////////////////////////////////////////
  98.     //
  99.     // This method must be overloaded in the derived class
  100.     //
  101.     //  OnPrimitiveCallback
  102.     //
  103.     //    All primitive-related events:  Events relating to Primitive controls
  104.     //
  105.     //    Examples:  Attribute changes, freeze/thaw notifications, real-time state (index) changes
  106.     //
  107.     //    The model should update its state, as well as the state of the rest of the processor-host
  108.     //    program, within this callback.
  109.     //
  110.     virtual EUAPI_FUNC void OnPrimitiveCallback( tEVT                  iEventType,
  111.                                                  NEuCon::uint32        iEventFlags,
  112.                                                  NEuCon::uint32        iControlId,  
  113.                                                  NEuCon::uint32        iArrayMemberControlId,  
  114.                                                  NEuCon::uint32        iPrimitiveId,   
  115.                                                  EuPrimitiveControl*   iAffectedPrimitive,  
  116.                                                  NEuCon::uint16        iNewValueIndex,  
  117.                                                  void*                 iCallbackEventData = NULL  );
  118.  
  119.  
  120.     /////////////////////////////////////////////////////////////////////////////////////////////////////
  121.     //
  122.     // This method must be overloaded in the derived class
  123.     //
  124.     //  OnControlCallback
  125.     //
  126.     //    All control-related events:  Events relating to control or control-array members
  127.     //
  128.     //    Examples:  Attribute changes, freeze/thaw notifications,
  129.     //               Add/Remove array members, etc.
  130.     //
  131.     //    Note:  Use iEventFlags to determine if the event involves a control, or a member
  132.     //           of a control array.  See kCONTROL_FLAG_xxx in EuDefinitions.h
  133.     //
  134.     //           iArrayMemberControlId is only used when (iEventFlags & kCONTROL_FLAG__MEMBER_EVENT == true)
  135.     //
  136.     virtual EUAPI_FUNC void OnControlCallback( tEVT            iEventType,            
  137.                                                NEuCon::uint32  iEventFlags,
  138.                                                NEuCon::uint32  iControlId,    
  139.                                                NEuCon::uint32  iArrayMemberControlId,
  140.                                                EuControl*      iAffectedControl,  
  141.                                                void*           iCallbackEventData = NULL  );
  142.  
  143.  
  144.     /////////////////////////////////////////////////////////////////////////////////////////////////////
  145.     //
  146.     // This method must be overloaded in the derived class
  147.     //
  148.     //  OnProcessorCallback
  149.     //
  150.     //    All processor events:  Events relating to this processor object
  151.     //
  152.     //    Examples:  Attribute changes, freeze/thaw notifications,
  153.     //               Add/Remove controls, etc.
  154.     //
  155.     virtual EUAPI_FUNC void OnProcessorCallback( tEVT              iEventType,            
  156.                                                  NEuCon::uint32    iEventFlags,
  157.                                                  void*             iCallbackEventData = NULL );
  158.  
  159.  
  160.  
  161.     /////////////////////////////////////////////////////////////////////////////////////////////////////
  162.     // The unique ID (persistence ID) used for this processor.  This may be non-human-readable form.
  163.     //
  164.     EUAPI_FUNC tERR SetPersistenceID(const tEuString& iPersistID);
  165.  
  166.     // A human-readable name you, as a developer/modeler, would use to identify this object.  Not for end users.
  167.     EUAPI_FUNC tERR SetSimpleFriendlyName(const tEuString& iFriendlyName);
  168.  
  169.     // The name that end-users might see
  170.     EUAPI_FUNC tERR SetUserVisibleName(const tEuString& iVisibleName);
  171.  
  172.  
  173.     EUAPI_FUNC tERR GetAssignedTo(std::vector<EuSurfaceBrowser>& oSurfaces) const;
  174.  
  175.     EUAPI_FUNC tERR AssignTo(const tEuString& iSurfaceFullInternalName);
  176.     EUAPI_FUNC tERR AssignTo(const EuSurfaceBrowser& iSurfaceBrowser);
  177.  
  178.     // Get an EuProcessorBrowser object for this EuProcessor.
  179.     EUAPI_FUNC tERR GetEuProcessorBrowser( EuProcessorBrowser** oppThisProcessorBrowser ) const;
  180.  
  181.     /////////////////////////////////////////////////////////////////
  182.     //
  183.     //  Refer to EuCommon base class for Attribute methods.
  184.     //
  185.     //    (SetAttribute, GetAttribute, and DeleteAttribute)
  186.     //
  187.     /////////////////////////////////////////////////////////////////
  188.  
  189.  
  190.     EUAPI_FUNC void GetSurfaceIsVisible( bool& iIsVisible ) const;
  191.  
  192.  
  193.     ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  194.     // These routines are called by a processor code to notify the surface controls to:  
  195.     EUAPI_FUNC tERR Freeze();   // Tell all Surface primitives in this control: do not send updates.
  196.     EUAPI_FUNC tERR Refresh(); // Tell all Surface primitives in this control: Update the surface with a new state (e.g., the table size and values have been altered.
  197.     EUAPI_FUNC tERR Thaw(); // Tell all Surface primitives in this control: resume sending updates.
  198.  
  199.  
  200.     // Reserved for use by EuCon
  201.     EUAPI_FUNC tERR  EuProcessorCommand( NEuCon::uint32 iCommandID,      NEuCon::uint32 iIntParam1,       NEuCon::uint32 iIntParam2,   
  202.                                          NEuCon::uint32& oIntParam,      void*  ioVoidPtr1 = NULL,        void*  ioVoidPtr2 = NULL   );
  203.  
  204. protected:
  205.     EuProcessor(const EuProcessor&);                // disallowed
  206.     bool operator=(const EuProcessor&);             // disallowed
  207.  
  208. public:
  209.     // Reserved, and new for EuCon 2.0
  210.     typedef void (*tOnConfirmValueCBV21)(NEuCon::tOpaquePtr iObj, NEuCon::uint32 iEventFlags, NEuCon::uint32 iControlId, NEuCon::uint32 iArrayMemberControlId,
  211.                                          NEuCon::uint32 iPrimitiveId, NEuCon::tOpaquePtr iAffectedPrimitive, NEuCon::uint16* ioRequestedNewValueIndex);
  212.     typedef void (*tOnPrimitiveCBV21)(NEuCon::tOpaquePtr iObj, NEuCon::int32 iEventType, NEuCon::uint32 iEventFlags, NEuCon::uint32 iControlId, NEuCon::uint32 iArrayMemberControlId,  
  213.                                       NEuCon::uint32 iPrimitiveId,  NEuCon::tOpaquePtr iAffectedPrimitive, NEuCon::tOpaquePtr iAffectedPrimitiveLegacy, NEuCon::int32 iAffectedPrimitiveType,
  214.                                       NEuCon::uint16 iNewValueIndex, NEuCon::tOpaquePtr iCallbackEventData);
  215.     typedef void (*tOnControlCBV21)(NEuCon::tOpaquePtr iObj, NEuCon::int32 iEventType, NEuCon::uint32 iEventFlags, NEuCon::uint32 iControlId, NEuCon::uint32 iArrayMemberControlId,
  216.                                     NEuCon::tOpaquePtr iAffectedControl, NEuCon::tOpaquePtr iCallbackEventData);
  217.     typedef void (*tOnProcessorCBV21)(NEuCon::tOpaquePtr iObj, NEuCon::int32 iEventType, NEuCon::uint32 iEventFlags, NEuCon::tOpaquePtr iCallbackEventData);
  218.  
  219. private:
  220.     tERR RegisterOnConfirmValueCallback(EuProcessor::tOnConfirmValueCBV21 iOnConfirmValueCallback);
  221.     tERR RegisterOnPrimitiveCallback(EuProcessor::tOnPrimitiveCBV21 iOnPrimitiveCallback);
  222.     tERR RegisterOnControlCallback(EuProcessor::tOnControlCBV21 iOnControlCallback);
  223.     tERR RegisterOnProcessorCallback(EuProcessor::tOnProcessorCBV21 iOnProcessorCallback);
  224.  
  225. };
  226.  
  227. #endif  // !defined(__EUPHONIX_EUPROCESSOR_H__)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement