summaryrefslogtreecommitdiffstats
path: root/src/server/GraphImpl.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-02-12 15:04:20 +0100
committerDavid Robillard <d@drobilla.net>2017-02-12 15:31:47 +0100
commitb1198f0842e6e4d6b1c01f07d91b42ef4a212788 (patch)
tree93fdf4da89a6f5f634707fb8c989e0d9ee1a3c65 /src/server/GraphImpl.hpp
parent81d45973412c675e3c0b4a10b64d811a219feeae (diff)
downloadingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.tar.gz
ingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.tar.bz2
ingen-b1198f0842e6e4d6b1c01f07d91b42ef4a212788.zip
Use smart pointers to handle real-time memory disposal
Diffstat (limited to 'src/server/GraphImpl.hpp')
-rw-r--r--src/server/GraphImpl.hpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp
index 57e60792..62af07f6 100644
--- a/src/server/GraphImpl.hpp
+++ b/src/server/GraphImpl.hpp
@@ -119,7 +119,7 @@ public:
uint32_t num_ports_non_rt() const;
typedef boost::intrusive::slist<
- DuplexPort, boost::intrusive::constant_time_size<true> > Ports;
+ DuplexPort, boost::intrusive::constant_time_size<true> > PortList;
void add_input(DuplexPort& port) {
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
@@ -165,12 +165,13 @@ public:
bool has_arc(const PortImpl* tail, const PortImpl* head) const;
/** Set a new compiled graph to run, and return the old one. */
- CompiledGraph* swap_compiled_graph(CompiledGraph* cp) INGEN_WARN_UNUSED_RESULT;
+ void set_compiled_graph(MPtr<CompiledGraph>&& cg);
- Raul::Array<PortImpl*>* external_ports() { return _ports; }
- void external_ports(Raul::Array<PortImpl*>* pa) { _ports = pa; }
+ const MPtr<Ports>& external_ports() { return _ports; }
- Raul::Array<PortImpl*>* build_ports_array();
+ void set_external_ports(MPtr<Ports>&& pa) { _ports = std::move(pa); }
+
+ MPtr<Ports> build_ports_array(Raul::Maid& maid);
/** Whether to run this graph's DSP bits in the audio thread */
bool enabled() const { return _process; }
@@ -183,14 +184,14 @@ public:
Engine& engine() { return _engine; }
private:
- Engine& _engine;
- uint32_t _poly_pre; ///< Pre-process thread only
- uint32_t _poly_process; ///< Process thread only
- CompiledGraph* _compiled_graph; ///< Process thread only
- Ports _inputs; ///< Pre-process thread only
- Ports _outputs; ///< Pre-process thread only
- Blocks _blocks; ///< Pre-process thread only
- bool _process; ///< True iff graph is enabled
+ Engine& _engine;
+ uint32_t _poly_pre; ///< Pre-process thread only
+ uint32_t _poly_process; ///< Process thread only
+ MPtr<CompiledGraph> _compiled_graph; ///< Process thread only
+ PortList _inputs; ///< Pre-process thread only
+ PortList _outputs; ///< Pre-process thread only
+ Blocks _blocks; ///< Pre-process thread only
+ bool _process; ///< True iff graph is enabled
};
} // namespace Server