NuPIC Core
Core algorithms for NuPIC(the Numenta Platform for Intelligent Computing), implemented in C++
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | List of all members
nta::Input Class Reference

Represents a named input to a Region. More...

#include <Input.hpp>

Public Types

typedef std::vector
< std::vector< size_t > > 
SplitterMap
 

Public Member Functions

 Input (Region &region, NTA_BasicType type, bool isRegionLevel)
 Constructor. More...
 
 ~Input ()
 Destructor.
 
void setName (const std::string &name)
 Set the name for the input. More...
 
const std::string & getName () const
 Get the name of the input. More...
 
void addLink (const std::string &linkType, const std::string &linkParams, Output *srcOutput)
 Create a new Link between this input and the srcOutput. More...
 
LinkfindLink (const std::string &srcRegionName, const std::string &srcOutputName)
 Locate an existing Link to the input. More...
 
void removeLink (Link *&link)
 Removing an existing link from the input. More...
 
void prepare ()
 Make input data available. More...
 
const Array & getData () const
 Get the data of the input. More...
 
RegiongetRegion ()
 Get the Region that the input belongs to. More...
 
const std::vector< Link * > & getLinks ()
 Get all the Link objects added to the input. More...
 
bool isRegionLevel ()
 Tells whether the input is region level. More...
 
size_t evaluateLinks ()
 Called by Region.evaluateLinks() as part of network initialization. More...
 
void initialize ()
 Initialize the Input . More...
 
bool isInitialized ()
 Tells whether the Input is initialized. More...
 
const SplitterMapgetSplitterMap () const
 Get splitter map from an initialized input. More...
 
template<typename T >
void getInputForNode (size_t nodeIndex, std::vector< T > &input) const
 explicitly instantiated for various types
 

Detailed Description

Represents a named input to a Region.

(e.g. bottomUpIn)

Note
Input is not available in the public API, but is visible by the RegionImpl.
Todo:
identify methods that may be called by RegionImpl – this is the internal "public interface"

Definition at line 56 of file Input.hpp.

Member Typedef Documentation

typedef std::vector< std::vector<size_t> > nta::Input::SplitterMap
See also
Link.buildSplitterMap()

Definition at line 247 of file Input.hpp.

Constructor & Destructor Documentation

nta::Input::Input ( Region region,
NTA_BasicType  type,
bool  isRegionLevel 
)

Constructor.

Parameters
regionThe region that the input belongs to.
typeThe type of the input, i.e. TODO
isRegionLevelWhether the input is region level, i.e. TODO

Member Function Documentation

void nta::Input::addLink ( const std::string &  linkType,
const std::string &  linkParams,
Output srcOutput 
)

Create a new Link between this input and the srcOutput.

The link will be added to this input and added to the list of links on the output

Parameters
linkTypeThe type of the link
linkParamsThe parameters of the link
srcOutputThe output of previous Region, which is also the source of the input
size_t nta::Input::evaluateLinks ( )

Called by Region.evaluateLinks() as part of network initialization.

  1. Tries to make sure that dimensions at both ends of a link are specified by calling setSourceDimensions() if possible, and then calling getDestDimensions()
  2. Ensures that region dimensions are consistent with either by setting destination region dimensions (this is where links "induce" dimensions) or by raising an exception if they are inconsistent.
Returns
Number of links that could not be fully evaluated, i.e. incomplete
Link* nta::Input::findLink ( const std::string &  srcRegionName,
const std::string &  srcOutputName 
)

Locate an existing Link to the input.

It's called by Network.removeLink() and internally when adding a link

Parameters
srcRegionNameThe name of the source Region
srcOutputNameThe name of the source Output
Returns
The link if found or NULL if no such link exists
const Array& nta::Input::getData ( ) const

Get the data of the input.

Returns
A mutable reference to the data of the input as an Array
const std::vector<Link*>& nta::Input::getLinks ( )

Get all the Link objects added to the input.

Returns
All the Link objects added to the input
const std::string& nta::Input::getName ( ) const

Get the name of the input.

Returns
The name of the input
Region& nta::Input::getRegion ( )

Get the Region that the input belongs to.

Returns
The mutable reference to the Region that the input belongs to
const SplitterMap& nta::Input::getSplitterMap ( ) const

Get splitter map from an initialized input.

Returns
The splitter map
void nta::Input::initialize ( )

Initialize the Input .

After the input has all the information it needs, it is initialized by this method. Volatile data structures (e.g. the input buffer) are set up。

bool nta::Input::isInitialized ( )

Tells whether the Input is initialized.

Returns
Whether the Input is initialized
bool nta::Input::isRegionLevel ( )

Tells whether the input is region level.

Returns
Whether the input is region level, i.e. TODO
void nta::Input::prepare ( )

Make input data available.

Called by Region.prepareInputs()

void nta::Input::removeLink ( Link *&  link)

Removing an existing link from the input.

It's called in four cases:

  1. Network.removeLink()
  2. Network.removeRegion() when given srcRegion
  3. Network.removeRegion() when given destRegion
  4. Network.~Network()

It is an error to call this if our containing region is uninitialized.

Note
This method will set the Link pointer to NULL on return (to avoid a dangling reference)
Parameters
linkThe Link to remove, possibly retrieved by findLink(), note that it is a reference to the pointer, not the pointer itself.
void nta::Input::setName ( const std::string &  name)

Set the name for the input.

Inputs need to know their own name for error messages.

Parameters
nameThe name of the input

The documentation for this class was generated from the following file: