iSpike  2.1
Spike conversion library for robotics
D:/Home/Programs/iSpike/src/Channel/OutputChannel/OutputChannelFactory.cpp
Go to the documentation of this file.
00001 #include "iSpike/Channel/OutputChannel/OutputChannelFactory.hpp"
00002 #include <iSpike/Channel/OutputChannel/JointOutputChannel.hpp>
00003 #include <iSpike/Writer/AngleWriter.hpp>
00004 #include "iSpike/ISpikeException.hpp"
00005 #include "iSpike/Log/Log.hpp"
00006 using namespace ispike;
00007 
00008 
00011 OutputChannelFactory::OutputChannelFactory()  {
00012         this->channelList.push_back(JointOutputChannel().getChannelDescription());
00013         printOutputChannels();
00014 }
00015 
00016 
00018 vector<Description> OutputChannelFactory::getAllChannels() {
00019         return channelList;
00020 }
00021 
00022 
00024 OutputChannel* OutputChannelFactory::create(Description& desc, Writer* writer, map<string,Property>& channelProperties) {
00025         if(desc.getName() == "Joint Output Channel") {
00026                 JointOutputChannel* channel = new JointOutputChannel();
00027                 channel->initialize((AngleWriter*)writer, channelProperties);
00028                 return channel;
00029         }
00030         throw ISpikeException("Invalid channel type");
00031 }
00032 
00033 
00035 map<string, Property> OutputChannelFactory::getDefaultProperties(Description& desc){
00036         if(desc.getName() == "Joint Output Channel") {
00037                 return JointOutputChannel().getProperties();
00038         }
00039         throw ISpikeException("Invalid output channel");
00040 }
00041 
00042 
00043 
00045 void OutputChannelFactory::printOutputChannels(){
00046         for(size_t i=0; i<channelList.size(); ++i)
00047                 LOG(LOG_DEBUG)<<"Output Channel: "<<channelList[i].getName()<<", "<<channelList[i].getDescription();
00048 }
00049 
00050 
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines