Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for next Iris core #9

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
54bc764
Adding analytics
suttonpd Sep 4, 2013
542a228
Add a Bitdeli badge to README
bitdeli-chef Sep 4, 2013
ada45d7
Merge pull request #6 from bitdeli-chef/master
paul-srs Sep 4, 2013
d9814c6
Merge pull request #8 from suttonpd/master
paul-srs Dec 3, 2013
c3fd875
Merge pull request #9 from suttonpd/master
suttonpd Dec 3, 2013
cce2d6d
Merge pull request #10 from suttonpd/master
suttonpd Dec 10, 2013
0d0ee23
Merge pull request #11 from suttonpd/master
suttonpd Dec 16, 2013
ae3956d
Merge pull request #12 from suttonpd/master
suttonpd Dec 17, 2013
48f3637
Merge pull request #13 from suttonpd/master
suttonpd Dec 19, 2013
474519b
Merge pull request #14 from softwareradiosystems/next
suttonpd Jan 6, 2014
db98fac
Rework colorful logging for console output only
Oct 16, 2013
7f900e4
enable compiling with -fPIC parameter on ARM architectures
Jan 10, 2014
df83da5
Merge branch 'next_misc' into next
Jan 10, 2014
9bf6c5a
allow PhyComponents to receive commands
Mar 4, 2014
2c0af26
add generic metadata header
Mar 12, 2014
0f2ce0d
add testcase for metadata class
Mar 12, 2014
35d43d6
adapt datastructures etc. to new metadata layout
Mar 12, 2014
0684f49
implement a configurable logging file
Jan 30, 2014
df48482
setting logging level after logging file
Apr 1, 2014
cf4f72c
Merge branch 'next_logging' into next
Apr 1, 2014
7ced083
Merge branch 'genericmetadata' into next
May 6, 2014
e81e1bf
Merge remote-tracking branch 'origin/next_phycomponentcommands' into …
May 6, 2014
81c6e61
allow PhyComponents to wait for commands
Jun 4, 2013
2dc6473
allow PhyComponents to wait for commands
Jun 4, 2013
5c05151
Merge branch 'next_phycomponentcommands' into next
May 6, 2014
e193835
add trapWait to Command scheme to avoid race conditions/deadlock amon…
May 15, 2013
965df3b
Merge branch 'next_commandtrap' into next
May 6, 2014
7a0c225
making sure metadata will be initialized correctly
May 26, 2014
242e50e
adding new test case for metadata handling
May 26, 2014
06d8904
Merge branch 'genericmetadata' into next
May 26, 2014
affcd9a
adding exception handling to metadata class
May 26, 2014
42cab71
Merge branch 'genericmetadata' into next
May 26, 2014
02a2b98
cleaning up metadata related header
Jun 2, 2014
552ac84
Merge branch 'genericmetadata' into next
Jun 2, 2014
9818f82
adding support for controllers to trigger events
Feb 18, 2015
2971f5e
Merge branch 'next_controllerevents' into next
Feb 18, 2015
5d43f49
disable type-checking for event parameter
May 16, 2013
b54668c
core: expose more functions for obtaining radio parameters
Feb 26, 2015
2a19c2d
Merge remote-tracking branch 'suttonpd/master' into next_reconf
Feb 26, 2015
cd305f0
Merge remote-tracking branch 'suttonpd/master' into next
Feb 26, 2015
616a25f
Merge branch 'next_eventtypecheck' into next
Feb 26, 2015
9b00b27
Merge branch 'next_reconf' into next
Feb 26, 2015
4d4a571
Merge remote-tracking branch 'suttonpd/master'
Feb 27, 2015
7a3dae1
core: adding separate work thread to controller base class
Feb 27, 2015
4a583f0
Merge branch 'next_controllerworkthread' into next
Feb 27, 2015
c017a8d
metadata: improve info when throwing exceptions
Mar 7, 2015
af030e8
fix bug in copy contructor where metadata map is actually not copied
Oct 19, 2015
25452a5
resolve ambiguity between different implementations of tie
Dec 7, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ ADD_CUSTOM_TARGET(uninstall
# Macro to add -fPIC property to static libs
########################################################################
MACRO(IRIS_SET_PIC)
IF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
IF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" )
SET_TARGET_PROPERTIES(${ARGV} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
ENDIF( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" )
ENDMACRO(IRIS_SET_PIC)

########################################################################
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ Optional:
## License

Iris is licensed under LGPL v3. For more information see LICENSE.

[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/565a545f5d61e93dd441e8ee1eea0a25 "githalytics.com")](http://githalytics.com/softwareradiosystems/iris_core)


[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/softwareradiosystems/iris_core/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

50 changes: 48 additions & 2 deletions iris/ControllerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
*
* Iris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
Expand Down Expand Up @@ -162,6 +162,52 @@ class ControllerManager
*/
std::string getParameterValue(std::string paramName, std::string componentName);

/** Get a components' parameter name
*
* @param componentName The name of the component containing the parameter.
* @param paramIndex The paramter index
* @return paramValue The parameter value returned by reference
*/
std::string getParameterName(std::string componentName, int paramIndex, std::string &paramValue);

/** Get the name of an engine
*
* @param componentName The name of the component that resides in the engine
* @param engineIndex The engine index
* @param compIndex The component index
* @return engineName The engine name
*/
std::string getEngineName(std::string componentName, int *engineIndex, int *compIndex);

/** Get the number of engines in the current radio
*
* @return The number of engine
*/
int getNrEngines();

/** Get the number of components in the current radio
*
* @return The number of components
*/
int getNrComponents();

/** Get the engine name for a given index
*
* @param index The index of the engine
* @return The name of the the engine
*/
std::string getEngineNameFromIndex(int index);

/** Get the component name for a given index
*
* @param index The index of the component
* @return The name of the the component
*/
std::string getComponentName(int index);

/// returns the number of parameters in a given component
int getNrParameters(std::string componentName);

/** Subscribe to an event (Called by controllers)
*
* @param eventName The event name.
Expand Down
15 changes: 15 additions & 0 deletions iris/ControllerManagerCallbackInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "irisapi/ReconfigurationDescriptions.h"
#include "irisapi/Command.h"
#include "RadioRepresentation.h"

namespace iris
{
Expand All @@ -56,6 +57,20 @@ class ControllerManagerCallbackInterface{
virtual void postCommand(Command command) = 0;

virtual std::string getParameterValue(std::string paramName, std::string componentName) = 0;

virtual std::string getParameterName(std::string componentName, int paramIndex, std::string &paramValue) = 0;

virtual std::string getEngineName(std::string componentName, int *engineIndex, int *compIndex) = 0;

virtual int getNrEngines() = 0;

virtual int getNrComponents() = 0;

virtual std::string getEngineNameFromIndex(int index) = 0;

virtual std::string getComponentName(int index) = 0;

virtual int getNrParameters(std::string componentName) = 0;
};

} // namespace iris
Expand Down
1 change: 0 additions & 1 deletion iris/DataBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class DataBuffer : public ReadBuffer<T>, public WriteBuffer<T>
isWriteLocked_ = true;
if(buffer_[writeIndex_].data.size() != size)
buffer_[writeIndex_].data.resize(size);
buffer_[writeIndex_].timeStamp = 0;
setPtr = &buffer_[writeIndex_];
};

Expand Down
7 changes: 7 additions & 0 deletions iris/EngineManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ class EngineManager:
void reconfigureRadio(ReconfigSet reconfigs);
void postCommand(Command command);
std::string getParameterValue(std::string paramName, std::string componentName);
std::string getParameterName(std::string componentName, int paramIndex, std::string &paramValue);
std::string getEngineName(std::string componentName, int *engineIndex, int *compIndex);
int getNrEngines();
int getNrComponents();
std::string getEngineNameFromIndex(int index);
std::string getComponentName(int index);
int getNrParameters(std::string componentName);
void activateEvent(Event &e);
};

Expand Down
7 changes: 5 additions & 2 deletions iris/Iris.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
*
* Iris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
Expand Down Expand Up @@ -63,6 +63,9 @@ IRIS_DLL bool IRISSetContRepository(std::string rep);
/// Set the log level
IRIS_DLL bool IRISSetLogLevel(std::string level);

/// Set the logging file
IRIS_DLL bool IRISSetLoggingFile(std::string file);

/** Load the radio
*
* \param radioConfig The radio configuration to load.
Expand Down
18 changes: 16 additions & 2 deletions iris/RadioRepresentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
*
* Iris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
Expand Down Expand Up @@ -221,6 +221,20 @@ class RadioRepresentation
static bool findComponent(std::string name, const RadioGraph& graph, Vertex& ver);
/// Find an engine in an EngineGraph
static bool findEngine(std::string name, const EngineGraph& graph, EngVertex& ver);
/// Get the engine name for a given component
std::string getEngineName(std::string componentName, int *engineIndex, int *compIndex);
/// Get the number of engines in the current radio
int getNrEngines();
/// Get the number of components in the current radio
int getNrComponents();
/// Get the engine name for a given index
std::string getEngineNameFromIndex(int index);
/// Get the component name for a given component index
std::string getComponentName(int index);
/// Get the number of parameters of a given component
int getNrParameters(std::string componentName);
/// Get a components' parameter name
std::string getParameterName(std::string componentName, int paramIndex, std::string &paramValue);

private:
/// Reconfigure a parameter within the representation
Expand Down
7 changes: 5 additions & 2 deletions iris/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
*
* Iris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
Expand Down Expand Up @@ -68,6 +68,9 @@ class System
/// Set the log level
void setLogLevel(std::string level);

/// Set the logging file
void setLoggingFile(std::string file);

/// Load a radio given a configuration file name
bool loadRadio(std::string radioConfig);

Expand Down
5 changes: 3 additions & 2 deletions irisapi/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
*
* Iris is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
Expand All @@ -44,6 +44,7 @@ struct Command
{
std::vector<boost::any> data; ///< Data passed with this command.
int typeId; ///< Type of the data.
bool trapWait; ///< Whether to wait for someone being caught before releasing trap.
std::string commandName; ///< Name of this command.
std::string componentName; ///< Target component.
std::string engineName; ///< Target engine.
Expand Down
31 changes: 22 additions & 9 deletions irisapi/CommandPrison.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class CommandPrison
boost::mutex::scoped_lock lock(mutex_);
boost::shared_ptr< Cage > cage(new Cage);
cages_.insert(CagePair(c,cage));
trapWaitCondition_.notify_all();
return cage->trap(lock);
}

Expand All @@ -129,15 +130,26 @@ class CommandPrison
*/
void release(Command c)
{
boost::mutex::scoped_lock lock(mutex_);
std::pair<CageMM::iterator, CageMM::iterator> found;
CageMM::iterator it;
found = cages_.equal_range(c.commandName);
for (it=found.first; it!=found.second; ++it)
{
it->second->release(c);
}
cages_.erase(found.first, found.second);
boost::mutex::scoped_lock lock(mutex_);
bool foundItem = false;
do
{
std::pair<CageMM::iterator, CageMM::iterator> found;
CageMM::iterator it;
found = cages_.equal_range(c.commandName);
for (it=found.first; it!=found.second; ++it)
{
it->second->release(c);
foundItem = true;
}
cages_.erase(found.first, found.second);
if (!c.trapWait)
break;

if (!foundItem && c.trapWait)
trapWaitCondition_.wait(lock);
}
while (!foundItem);
}

/// Get the number of threads currently held in this CommandPrison.
Expand All @@ -153,6 +165,7 @@ class CommandPrison

mutable boost::mutex mutex_; ///< Mutex protecting this CommandPrison.
CageMM cages_; ///< The cages within this CommandPrison.
boost::condition_variable trapWaitCondition_; ///< Wait condition variable for CommandPrision.

};

Expand Down
64 changes: 30 additions & 34 deletions irisapi/ComponentEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct EventDescription

/** An interface to the events of a component
*
* The ComponentEvents class permits components to register events of different types.
* The ComponentEvents class permits components to register events of different types.
* These events can then be triggered by the component together with relevent data.
*/
class ComponentEvents : boost::noncopyable
Expand Down Expand Up @@ -113,22 +113,22 @@ inline void ComponentEvents::activateEventInternal(std::string compName, std::st
std::map<std::string, EventDescription>::const_iterator it = events_.find(name);
if (it == events_.end())
throw EventNotFoundException("Event " + name + " not found");
if(it->second.typeId == TypeInfo<T>::identifier)
{
//std::vector<boost::any> d;
//d.push_back(boost::any(data));
//d_engine->activateEvent(name, d);
Event e;
e.data.push_back(boost::any(data));
e.eventName = name;
e.componentName = compName;
e.typeId = TypeInfo<T>::identifier;
engine_->activateEvent(e);
return;
}else{
throw InvalidDataTypeException("Event data type did not match registered type for event " + name);
}

/*
* FIXME:
* - disable typeId check to allow complex types beyond TypeInfo.h
* - type checking could be done using a boost::any_cast
*/
//std::vector<boost::any> d;
//d.push_back(boost::any(data));
//d_engine->activateEvent(name, d);
Event e;
e.data.push_back(boost::any(data));
e.eventName = name;
e.componentName = compName;
e.typeId = TypeInfo<T>::identifier;
engine_->activateEvent(e);
return;
}

template<typename T>
Expand All @@ -145,23 +145,19 @@ inline void ComponentEvents::activateEventInternal(std::string compName, std::st
if (it == events_.end())
throw EventNotFoundException("Event " + name + " not found");

if(it->second.typeId == TypeInfo<T>::identifier)
{
//std::vector<boost::any> d;
//d.resize(data.size());
//std::copy(data.begin(), data.end(), d.begin());
//d_engine->activateEvent(name, d);
Event e;
e.data.resize(data.size());
std::copy(data.begin(), data.end(), e.data.begin());
e.eventName = name;
e.componentName = compName;
e.typeId = TypeInfo<T>::identifier;
engine_->activateEvent(e);
return;
}else{
throw InvalidDataTypeException("Event data type did not match registered type for event " + name);
}
// disable type checking as well, see above for comments
//std::vector<boost::any> d;
//d.resize(data.size());
//std::copy(data.begin(), data.end(), d.begin());
//d_engine->activateEvent(name, d);
Event e;
e.data.resize(data.size());
std::copy(data.begin(), data.end(), e.data.begin());
e.eventName = name;
e.componentName = compName;
e.typeId = TypeInfo<T>::identifier;
engine_->activateEvent(e);
return;
}

} // namespace iris
Expand Down
Loading