Port - constructor used to construct a standard port object, needs a reference to the parent kernel for the port_info struct
- Parameters
-
port.cpp -
- Author
- : Jonathan Beard
- Version
- : Thu Aug 28 09:55:47 2014
Copyright 2014 Jonathan Beard
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Port::Port |
( |
raft::kernel * |
k, |
|
|
void *const |
ptr, |
|
|
const std::size_t |
nbytes |
|
) |
| |
Port - constructor used to construct a port with pre-allocated memory, useful for things like array distribution and reduction
- Parameters
-
k | - raft::kernel* |
ptr | - void* |
nbytes | - const std::size_t length in bytes |
~Port - destructor, deletes the FIFO that was given when the object was initalized.
the port map is allocated on the heap so the port_info destructor is called
template<class T >
bool Port::addPort |
( |
const std::string |
port_name | ) |
|
|
inline |
addPort - adds and initializes a port for the name given. Function returns true if added, false if not. Main reason for returning false would be that the port already exists.
- Parameters
-
port_name | - const std::string |
- Returns
- bool
we'll have to make a port info object first and pass it by copy to the portmap. Perhaps re-work later with pointers, but for right now this will work and it doesn't necessarily have to be performant since its only executed once.
template<class T >
bool Port::addPorts |
( |
const std::size_t |
n_ports = 0 | ) |
|
|
inline |
addPorts - add ports for an existing buffer, basically allocate buffers in place. These also won't be able to be resized.
- Parameters
-
n_ports | - const std::size_t |
pointer
std::size_t Port::count |
( |
| ) |
|
count - get the total number of fifos within this port container
- Returns
- std::size_t
getPortInfo - returns the PortInfo struct for a kernel if we expect it to have a single port. If there's more than one port this function throws an exception.
- Returns
- std::pair< std::string, PortInfo& >
TODO: extract kernel name to go here too
PortInfo & Port::getPortInfoFor |
( |
const std::string |
port_name | ) |
|
|
protected |
getPortInfoFor - gets port information for the param port throws an exception if the port doesn't exist.
- Parameters
-
port_name | - const std::string |
- Returns
- PortInfo&
const std::type_index & Port::getPortType |
( |
const std::string |
port_name | ) |
|
getPortType - input the port name, and get the hash for the type of the port. This function is useful for checking the streaming graph to make sure all the ports that are "dynamically" created do in fact have compatible types.
- Parameters
-
port_name | - const std::string |
- Returns
- const type_index&
- Exceptions
-
hasPorts - returns true if any ports exists, false otherwise.
- Returns
- bool
Implements PortBase.
template<class T >
void Port::initializeConstMap |
( |
PortInfo & |
pi | ) |
|
|
inlineprotected |
initializeConstMap - hack to get around the inability to otherwise initialize a template function where later we don't have the template parameter. NOTE: this is a biggy, if we have more FIFO types in the future (i.e., sub-classes of FIFO) then we must create an entry here otherwise bad things will happen.
- Parameters
-
no instrumentation
yes instrumentation
no instrumentation
no instrumentation version defined yet
FIFO & Port::operator[] |
( |
const std::string |
port_name | ) |
|
|
virtual |
operator[] - input the port name and get a port if it exists.
Implements PortBase.
void* const Port::alloc_ptr = nullptr |
|
protected |
ptr used for in-place allocations, will not be deleted by the map, also should not be modified by the map either.
const std::size_t Port::alloc_ptr_length = 0 |
|
protected |
alloc_ptr_length - length of alloc_ptr in bytes.
parent kernel that owns this port
portmap - container struct with all ports. The mutex should be locked before accessing this structure
The documentation for this class was generated from the following files: