DSPatch  v.5.01
Circuit.h
1 /************************************************************************
2 DSPatch - The C++ Flow-Based Programming Framework
3 Copyright (c) 2012-2018 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 LICENSE included in the packaging of this file.
11 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 #pragma once
26 
27 #include <dspatch/Component.h>
28 
29 namespace DSPatch
30 {
31 
32 namespace internal
33 {
34 class Circuit;
35 }
36 
38 
57 class DLLEXPORT Circuit final
58 {
59 public:
60  NONCOPYABLE( Circuit );
61  DEFINE_PTRS( Circuit );
62 
63  Circuit();
64  ~Circuit();
65 
66  int AddComponent( Component::SPtr const& component );
67 
68  void RemoveComponent( Component::SCPtr const& component );
69  void RemoveComponent( int componentIndex );
70  void RemoveAllComponents();
71 
72  int GetComponentCount() const;
73 
74  bool ConnectOutToIn( Component::SCPtr const& fromComponent, int fromOutput, Component::SCPtr const& toComponent, int toInput );
75  bool ConnectOutToIn( Component::SCPtr const& fromComponent, int fromOutput, int toComponent, int toInput );
76  bool ConnectOutToIn( int fromComponent, int fromOutput, Component::SCPtr const& toComponent, int toInput );
77  bool ConnectOutToIn( int fromComponent, int fromOutput, int toComponent, int toInput );
78 
79  void DisconnectComponent( Component::SCPtr const& component );
80  void DisconnectComponent( int componentIndex );
81 
82  void SetThreadCount( int threadCount );
83  int GetThreadCount() const;
84 
85  void Tick();
86 
87  void StartAutoTick();
88  void StopAutoTick();
89  void PauseAutoTick();
90  void ResumeAutoTick();
91 
92 private:
93  std::unique_ptr<internal::Circuit> p;
94 };
95 
96 } // namespace DSPatch
Workspace for adding and routing components.
Definition: Circuit.h:57