Skip to content

Commit

Permalink
First demo
Browse files Browse the repository at this point in the history
Hello world
  • Loading branch information
diegoferigo committed Feb 21, 2018
1 parent c3387d1 commit d8e4a56
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
14 changes: 11 additions & 3 deletions toolbox/include/base/CoderBlockInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ namespace wbt {

class wbt::CoderBlockInformation : public wbt::BlockInformation
{
private:
private:
typedef int Rows;
typedef int Cols;
typedef unsigned SignalIndex;

std::vector<wbt::ParameterMetadata> m_paramsMetadata;
std::unordered_map<unsigned, wbt::Signal> m_inputSignals;
std::unordered_map<unsigned, wbt::Signal> m_outputSignals;
std::unordered_map<SignalIndex, wbt::Signal> m_inputSignals;
std::unordered_map<SignalIndex, wbt::Signal> m_outputSignals;

std::string m_confBlockName;
Parameters m_parametersFromRTW;

std::unordered_map<SignalIndex, std::pair<Rows, Cols>> m_inputSignalSize;
std::unordered_map<SignalIndex, std::pair<Rows, Cols>> m_outputSignalSize;

// Private? Static?
// TODO
static bool containConfigurationData(const wbt::Parameters& parameters);

public:
Expand Down
2 changes: 1 addition & 1 deletion toolbox/src/SetReferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ bool SetReferences::terminate(const BlockInformation* blockInfo)
return ok && WBBlock::terminate(blockInfo);
}

bool SetReferences::initializeInitialConditions(const BlockInformation* blockInfo)
bool SetReferences::initializeInitialConditions(const BlockInformation* /*blockInfo*/)
{
// This function is called when a subsystem with Enable / Disable support is used.
// In this case all the blocks in this subsystem are configured and initialize,
Expand Down
31 changes: 22 additions & 9 deletions toolbox/src/base/CoderBlockInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <string>
#include <vector>
#include <utility>

using namespace wbt;

Expand All @@ -14,7 +15,7 @@ using namespace wbt;

bool CoderBlockInformation::optionFromKey(const std::string& key, double& option) const
{
return false;
return true;
}

// PARAMETERS METHODS
Expand All @@ -25,32 +26,36 @@ bool CoderBlockInformation::optionFromKey(const std::string& key, double& option

bool CoderBlockInformation::setNumberOfInputPorts(unsigned numberOfPorts)
{
return false;
return true;
}

bool CoderBlockInformation::setNumberOfOutputPorts(unsigned numberOfPorts)
{
return false;
return true;
}

bool CoderBlockInformation::setInputPortVectorSize(unsigned portNumber, int portSize)
{
return false;
m_inputSignalSize[portNumber] = {1, portSize};
return true;
}

bool CoderBlockInformation::setInputPortMatrixSize(unsigned portNumber, int rows, int columns)
{
return false;
m_inputSignalSize[portNumber] = {rows, columns};
return true;
}

bool CoderBlockInformation::setOutputPortVectorSize(unsigned portNumber, int portSize)
{
return false;
m_outputSignalSize[portNumber] = {1, portSize};
return true;
}

bool CoderBlockInformation::setOutputPortMatrixSize(unsigned portNumber, int rows, int columns)
{
return false;
m_outputSignalSize[portNumber] = {rows, columns};
return true;
}

bool CoderBlockInformation::setInputPortType(unsigned portNumber, PortDataType portType)
Expand All @@ -68,12 +73,20 @@ bool CoderBlockInformation::setOutputPortType(unsigned portNumber, PortDataType

unsigned CoderBlockInformation::getInputPortWidth(unsigned portNumber) const
{
return false;
if (m_inputSignalSize.find(portNumber) == m_inputSignalSize.end()) {
return 0;
}

return static_cast<unsigned>(m_inputSignalSize.at(portNumber).second);
}

unsigned CoderBlockInformation::getOutputPortWidth(unsigned portNumber) const
{
return false;
if (m_outputSignalSize.find(portNumber) == m_outputSignalSize.end()) {
return 0;
}

return static_cast<unsigned>(m_outputSignalSize.at(portNumber).second);
}

wbt::Signal CoderBlockInformation::getInputPortSignal(unsigned portNumber, int portWidth) const
Expand Down

0 comments on commit d8e4a56

Please sign in to comment.