Kaspersky Neuromorphic Platform  1.0.0
API Reference
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1
22#pragma once
23
24#include <knp/core/core.h>
25#include <knp/core/impexp.h>
31
32#include <memory>
33#include <tuple>
34#include <unordered_map>
35#include <utility>
36#include <vector>
37
38
42namespace knp::framework
43{
44
49class KNP_DECLSPEC Model
50{
51public:
56 explicit Model(knp::framework::Network &&network) : network_(std::move(network)) {}
57
58public:
63 [[nodiscard]] const knp::core::UID &get_uid() const { return base_.uid_; }
69 [[nodiscard]] auto &get_tags() { return base_.tags_; }
70
71public:
76 [[nodiscard]] knp::framework::Network &get_network() { return network_; }
82 [[nodiscard]] const knp::framework::Network &get_network() const { return network_; }
83
89 void add_input_channel(const core::UID &channel_uid, const core::UID &projection_uid);
90
96 template <typename SynapseType>
97 void connect_input_projection(const core::UID &channel_uid, const core::Projection<SynapseType> &projection)
98 {
99 add_input_channel(channel_uid, projection.get_uid());
100 }
101
107 void add_output_channel(const core::UID &channel_uid, const core::UID &population_uid);
108
114 template <typename NeuronType>
115 void connect_output_population(const core::UID &channel_uid, const core::Population<NeuronType> &population)
116 {
117 add_output_channel(channel_uid, population.get_uid());
118 }
119
124 const std::unordered_multimap<core::UID, core::UID, core::uid_hash> &get_input_channels() const;
129 const std::unordered_multimap<core::UID, core::UID, core::uid_hash> &get_output_channels() const;
130
131private:
132 knp::core::BaseData base_;
133 knp::framework::Network network_;
134 // cppcheck-suppress unusedStructMember
135 std::unordered_multimap<core::UID, core::UID, core::uid_hash> in_channels_;
136 // cppcheck-suppress unusedStructMember
137 std::unordered_multimap<core::UID, core::UID, core::uid_hash> out_channels_;
138};
139
140} // namespace knp::framework
Backend loader interface.
const UID & get_uid() const
Get population UID.
Definition population.h:88
const UID & get_uid() const
Get projection UID.
Definition projection.h:195
The Model class is a definition of a model that contains a network, input and output channels,...
Definition model.h:50
const std::unordered_multimap< core::UID, core::UID, core::uid_hash > & get_input_channels() const
Return all input channels.
auto & get_tags()
Get tags used by the model.
Definition model.h:69
const knp::framework::Network & get_network() const
Get network associated with the model.
Definition model.h:82
void connect_output_population(const core::UID &channel_uid, const core::Population< NeuronType > &population)
Add an output channel to the network.
Definition model.h:115
const std::unordered_multimap< core::UID, core::UID, core::uid_hash > & get_output_channels() const
Return all output channels.
void add_output_channel(const core::UID &channel_uid, const core::UID &population_uid)
Add an output channel to the network.
void connect_input_projection(const core::UID &channel_uid, const core::Projection< SynapseType > &projection)
Add an input channel to the network.
Definition model.h:97
void add_input_channel(const core::UID &channel_uid, const core::UID &projection_uid)
Add an input channel to the network.
knp::framework::Network & get_network()
Get network associated with the model.
Definition model.h:76
Model(knp::framework::Network &&network)
Model constructor.
Definition model.h:56
const knp::core::UID & get_uid() const
Get model UID.
Definition model.h:63
Class definition for core library basic entities.
Header for input channel.
Framework namespace.
Network interface.
Observer class that unloads messages and stores them.
Header for output channel.