BVB Source Codes

CRYENGINE Show FlowFilters.h Source code

Return Download CRYENGINE: download FlowFilters.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   FlowFilters.h
  5. //  Version:     v1.00
  6. //  Created:     27/03/2006 by AlexL
  7. //  Compilers:   Visual Studio.NET 2003
  8. //  Description: Some Inspector filters
  9. // -------------------------------------------------------------------------
  10. //  History:
  11. //
  12. ////////////////////////////////////////////////////////////////////////////
  13.  
  14. #ifndef __FLOWFILTERS_H__
  15. #define __FLOWFILTERS_H__
  16.  
  17. #include <CryFlowGraph/IFlowSystem.h>
  18.  
  19. typedef enum
  20. {
  21.         eFF_AIAction,
  22.         eFF_Entity,
  23.         eFF_Node
  24. } TFlowInspectorFilter;
  25.  
  26. class CFlowFilterBase : public IFlowGraphInspector::IFilter
  27. {
  28. protected:
  29.         CFlowFilterBase(TFlowInspectorFilter type) : m_type(type), m_refs(0) {}
  30.  
  31. public:
  32.         virtual void AddRef()
  33.         {
  34.                 ++m_refs;
  35.         }
  36.  
  37.         virtual void Release()
  38.         {
  39.                 if (--m_refs <= 0)
  40.                         delete this;
  41.         }
  42.  
  43.         virtual TFlowInspectorFilter GetTypeId() const
  44.         {
  45.                 return m_type;
  46.         }
  47.  
  48.         virtual void AddFilter(IFlowGraphInspector::IFilterPtr pFilter)
  49.         {
  50.                 stl::push_back_unique(m_filters, pFilter);
  51.         }
  52.  
  53.         virtual void RemoveFilter(IFlowGraphInspector::IFilterPtr pFilter)
  54.         {
  55.                 stl::find_and_erase(m_filters, pFilter);
  56.         }
  57.  
  58.         virtual const IFlowGraphInspector::IFilter_AutoArray& GetFilters() const
  59.         {
  60.                 return m_filters;
  61.         }
  62.  
  63. protected:
  64.         TFlowInspectorFilter                   m_type;
  65.         int                                    m_refs;
  66.         IFlowGraphInspector::IFilter_AutoArray m_filters;
  67. public:
  68.         // quick/dirty factory by name
  69.         // but actual CFlowFilter instances can also be instantiated explicetly
  70.         static CFlowFilterBase* CreateFilter(const char* filterType);
  71. };
  72.  
  73. class CFlowFilterEntity : public CFlowFilterBase
  74. {
  75. public:
  76.         static const char* GetClassName() { return "Entity"; }
  77.  
  78.         // filter lets only pass flows which happen in this entity's graph
  79.         CFlowFilterEntity();
  80.         void                  SetEntity(EntityId entityId) { m_entityId = entityId; }
  81.         EntityId              GetEntity() const            { return m_entityId; }
  82.  
  83.         virtual EFilterResult Apply(IFlowGraph* pGraph, const SFlowAddress from, const SFlowAddress to);
  84.  
  85. protected:
  86.         EntityId m_entityId;
  87. };
  88.  
  89. class CFlowFilterAIAction : public CFlowFilterBase
  90. {
  91. public:
  92.         static const char* GetClassName() { return "AIAction"; }
  93.  
  94.         // filter lets only pass AIAction flows for a specific AIAction
  95.         // if ActionName is empty works on all AIActions
  96.         // optionally works on specific user class, object class, user ID, objectID
  97.         // all can be mixed
  98.         CFlowFilterAIAction();
  99.         void                  SetAction(const string& actionName) { m_actionName = actionName; }
  100.         const string&         GetAction() const                   { return m_actionName; }
  101.  
  102.         void                  SetParams(const string& userClass, const string& objectClass, EntityId userId = 0, EntityId objectId = 0);
  103.         void                  GetParams(string& userClass, EntityId& userId, string& objectClass, EntityId& objectId) const;
  104.  
  105.         virtual EFilterResult Apply(IFlowGraph* pGraph, const SFlowAddress from, const SFlowAddress to);
  106.  
  107. protected:
  108.         string   m_actionName;
  109.         string   m_userClass;
  110.         string   m_objectClass;
  111.         EntityId m_userId;    // will be 0 if we run on all entity classes
  112.         EntityId m_objectId;  // will be 0 if we run on all entity classes
  113. };
  114.  
  115. class CFlowFilterNode : public CFlowFilterBase
  116. {
  117. public:
  118.         static const char* GetClassName() { return "Node"; }
  119.  
  120.         // filter lets only pass flows for nodes of a specific type and node id
  121.         CFlowFilterNode();
  122.         void                  SetNodeType(const string& nodeTypeName) { m_nodeType = nodeTypeName; }
  123.         const string&         GetNodeType() const                     { return m_nodeType; }
  124.  
  125.         void                  SetParams(const TFlowNodeId id)         { m_nodeId = id; }
  126.         void                  GetParams(TFlowNodeId& id) const        { id = m_nodeId; }
  127.  
  128.         virtual EFilterResult Apply(IFlowGraph* pGraph, const SFlowAddress from, const SFlowAddress to);
  129.  
  130. protected:
  131.         string      m_nodeType;
  132.         TFlowNodeId m_nodeId;
  133. };
  134.  
  135. #endif
  136.  
downloadFlowFilters.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top