#include <unistd.h>
#include <sched.h>
#include "proc2.h"
#include <iostream>
#include "data.h"
// Module specification
// <rtc-template block="module_spec">
static const char* consolein_spec[] =
  {
    "implementation_id", "proc2",
    "type_name",         "proc2",
    "description",       "data movement component",
    "version",           "1.0",
    "vendor",            "Yoshiji Yasu, KEK",
    "category",          "measurement",
    "activity_type",     "SPORADIC",
    "kind",              "DataFlowComponent",
    "max_instance",      "10",
    "language",          "C++",
    "lang_type",         "compile",
    ""
  };
// </rtc-template>

proc2::proc2(RTC::Manager* manager)
  : RTC::DataFlowComponentBase(manager),
    // <rtc-template block="initializer">
    m_outSeqOut("out2", m_outSeq), m_inSeqIn("in2", m_inSeq),  
    // </rtc-template>
    m_InOut(m_outSeqOut),
    dummy(0) 
{
  registerInPort("in2", m_inSeqIn);
  m_inSeq.data.length(LENGTH);
  
  registerOutPort("out2", m_outSeqOut);
  m_outSeq.data.length(LENGTH);

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">

  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>
  m_inSeqIn.setOnWrite(&m_InOut);
}

proc2::~proc2()
{
}

RTC::ReturnCode_t proc2::onInitialize()
{
  return RTC::RTC_OK;
}


RTC::ReturnCode_t proc2::onExecute(RTC::UniqueId ec_id)
{
  return RTC::RTC_OK;
}


extern "C"
{
 
  void proc2Init(RTC::Manager* manager)
  {
    RTC::Properties profile(consolein_spec);
    manager->registerFactory(profile,
                             RTC::Create<proc2>,
                             RTC::Delete<proc2>);
  }
  
};


