DSPatch  v.2.42
C++ Cross-Platform, Object-Oriented, Flow-Based Programming Library
 All Classes Pages
DSPatch.cpp
1 /************************************************************************
2 DSPatch - Cross-Platform, Object-Oriented, Flow-Based Programming Library
3 Copyright (c) 2012-2013 Marcus Tomlinson
4 
5 This file is part of DSPatch.
6 
7 GNU Lesser General Public License Usage
8 This file may be used under the terms of the GNU Lesser General Public
9 License version 3.0 as published by the Free Software Foundation and
10 appearing in the file LGPLv3.txt included in the packaging of this
11 file. Please review the following information to ensure the GNU Lesser
12 General Public License version 3.0 requirements will be met:
13 http://www.gnu.org/copyleft/lgpl.html.
14 
15 Other Usage
16 Alternatively, this file may be used in accordance with the terms and
17 conditions contained in a signed written agreement between you and
18 Marcus Tomlinson.
19 
20 DSPatch is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 ************************************************************************/
24 
25 #include "../include/DSPatch.h"
26 
27 //=================================================================================================
28 
29 DspCircuit* DSPatch::_globalCircuit = new DspCircuit();
30 
31 //=================================================================================================
32 
33 bool DSPatch::IsThisGlobalCircuit( DspComponent* thisComponent )
34 {
35  if( _globalCircuit != NULL )
36  {
37  return _globalCircuit == thisComponent;
38  }
39 
40  return false;
41 }
42 
43 //-------------------------------------------------------------------------------------------------
44 
45 bool DSPatch::AddGlobalComponent( DspComponent* component, std::string componentName )
46 {
47  if( _globalCircuit != NULL )
48  {
49  return _globalCircuit->AddComponent( component, componentName );
50  }
51 
52  return false;
53 }
54 
55 //-------------------------------------------------------------------------------------------------
56 
57 void DSPatch::RemoveGlobalComponent( DspComponent* component )
58 {
59  if( _globalCircuit != NULL )
60  {
61  return _globalCircuit->RemoveComponent( component );
62  }
63 }
64 
65 //-------------------------------------------------------------------------------------------------
66 
67 unsigned short DSPatch::GetGlobalComponentCount()
68 {
69  if( _globalCircuit != NULL )
70  {
71  return _globalCircuit->GetComponentCount();
72  }
73 
74  return 0;
75 }
76 
77 //-------------------------------------------------------------------------------------------------
78 
79 void DSPatch::StartGlobalAutoTick()
80 {
81  if( _globalCircuit != NULL )
82  {
83  _globalCircuit->StartAutoTick();
84  }
85 }
86 
87 //-------------------------------------------------------------------------------------------------
88 
89 void DSPatch::StopGlobalAutoTick()
90 {
91  if( _globalCircuit != NULL )
92  {
93  _globalCircuit->StopAutoTick();
94  }
95 }
96 
97 //-------------------------------------------------------------------------------------------------
98 
99 void DSPatch::SetGlobalThreadCount( unsigned short threadCount )
100 {
101  if( _globalCircuit != NULL )
102  {
103  _globalCircuit->SetThreadCount( threadCount );
104  }
105 }
106 
107 //-------------------------------------------------------------------------------------------------
108 
109 void DSPatch::Finalize()
110 {
111  delete _globalCircuit;
112  _globalCircuit = NULL;
113 }
114 
115 //=================================================================================================