Esempio n. 1
0
NavigatePlugin::NavigatePlugin(unsigned base, Buffer *config)
        : Plugin(base)
{
    load_data(navigateData, &data, config);
    CmdMail = registerType();
    CmdMailList = registerType();
    MenuMail = registerType();

    Event eMenu(EventMenuCreate, (void*)MenuMail);
    eMenu.process();

    Command cmd;
    cmd->id          = CmdMail;
    cmd->text        = I18N_NOOP("Send mail");
    cmd->icon		 = "mail_generic";
    cmd->menu_id     = MenuContact;
    cmd->menu_grp    = 0x30F0;
    cmd->popup_id    = 0;
    cmd->flags		 = COMMAND_CHECK_STATE;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    cmd->id			 = CmdMailList;
    cmd->text		 = "_";
    cmd->menu_grp	 = 0x1000;
    cmd->menu_id	 = MenuMail;

    eCmd.process();
}
Esempio n. 2
0
WeatherPlugin::WeatherPlugin(unsigned base, bool bInit, const char *config)
        : Plugin(base)
{
    load_data(weatherData, &data, config);
    memset(&m_handler, 0, sizeof(m_handler));
    m_handler.startElement = p_element_start;
    m_handler.endElement   = p_element_end;
    m_handler.characters   = p_char_data;
    BarWeather = registerType();
    CmdWeather = registerType();
    EventWeather = registerType();
    Event eBar(EventToolbarCreate, (void*)BarWeather);
    eBar.process();
    IconDef icon;
    icon.name = "weather";
    icon.xpm  = na;
    Event eIcon(EventAddIcon, &icon);
    eIcon.process();
    Command cmd;
    cmd->id = CmdWeather;
    cmd->text = I18N_NOOP("Not connected");
    cmd->icon = "weather";
    cmd->bar_id = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags = BTN_PICT;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    m_bar = NULL;
    m_fetch_id = 0;
    if (!bInit){
        showBar();
        if (m_bar)
            m_bar->show();
    }
}
Esempio n. 3
0
 JobManager::JobManager (LV2Plugin& p)
     : plugin (p), forge (p.get_uris(), p.get_urid_map(), p.get_urid_unmap()),
       workForge (p.get_uris(), p.get_urid_map(), p.get_urid_unmap())
 {
     registerType (new ObjectDisposalJobType ());
     registerType (new MediaLoaderJobType ());
 }
Esempio n. 4
0
WeatherPlugin::WeatherPlugin(unsigned base, bool bInit, Buffer *config)
        : Plugin(base)
{
    load_data(weatherData, &data, config);
    BarWeather = registerType();
    CmdWeather = registerType();
    EventWeather = registerType();
    m_icons = getIcons()->addIconSet("icons/weather.jisp", true);
    Event eBar(EventToolbarCreate, (void*)BarWeather);
    eBar.process();
    Command cmd;
    cmd->id = CmdWeather;
    cmd->text = I18N_NOOP("Not connected");
    cmd->icon = "weather";
    cmd->bar_id = BarWeather;
    cmd->bar_grp = 0x1000;
    cmd->flags = BTN_PICT | BTN_DIV;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    m_bar = NULL;
    if (!bInit){
        showBar();
        if (m_bar)
            m_bar->show();
    }
}
Esempio n. 5
0
MSNPlugin::MSNPlugin(unsigned base)
        : Plugin(base)
{
    MSNPacket = registerType();
    EventAddOk   = registerType();
    EventAddFail = registerType();
    MSNInitMail  = registerType();
    MSNNewMail   = registerType();

    getContacts()->addPacketType(MSNPacket, msn_descr.text, true);

    IconDef icon;
    icon.name  = "lunch";
    icon.xpm   = lunch;
    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    icon.name  = "onback";
    icon.xpm   = onback;
    eIcon.process();

    icon.name  = "onphone";
    icon.xpm   = onphone;
    eIcon.process();

    m_protocol = new MSNProtocol(this);
}
Esempio n. 6
0
AboutPlugin::AboutPlugin(unsigned base)
        : Plugin(base)
{
    CmdBugReport = registerType();
    CmdAbout = registerType();
#ifdef USE_KDE
    CmdAboutKDE = registerType();
#endif

    Command cmd;
    cmd->id			= CmdBugReport;
    cmd->text		= I18N_NOOP("&Bug report");
    cmd->bar_id		= ToolBarMain;
    cmd->menu_id	= MenuMain;
    cmd->menu_grp	= 0xF000;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    about = NULL;
    cmd->id			= CmdAbout;
    cmd->text		= I18N_NOOP("&About SIM");
    cmd->icon		= "licq";
    eCmd.process();

#ifdef USE_KDE
    about_kde = NULL;
    cmd->id			= CmdAboutKDE;
    cmd->text		= I18N_NOOP("About &KDE");
    cmd->icon		= "about_kde";
    eCmd.process();
#endif
}
Esempio n. 7
0
FilterPlugin::FilterPlugin(unsigned base, const char *cfg)
        : Plugin(base), EventReceiver(HighPriority - 1)
{
    filterPlugin = this;

    load_data(filterData, &data, cfg);
    user_data_id = getContacts()->registerUserData(info.title, filterUserData);

    CmdIgnoreList	= registerType();
    CmdIgnore		= registerType();
	CmdIgnoreText	= registerType();

    IconDef icon;
    icon.name = "ignorelist";
    icon.xpm  = ignorelist;
    icon.isSystem = false;

    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    Command cmd;
    cmd->id          = CmdIgnoreList;
    cmd->text        = I18N_NOOP("Ignore list");
    cmd->menu_id     = MenuContactGroup;
    cmd->menu_grp    = 0x8080;
    cmd->flags		 = COMMAND_CHECK_STATE;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    cmd->id          = CmdIgnore;
    cmd->text        = I18N_NOOP("Ignore user");
    cmd->icon		 = "ignorelist";
    cmd->menu_id     = 0;
    cmd->menu_grp    = 0;
    cmd->bar_id		 = ToolBarContainer;
    cmd->bar_grp	 = 0x7001;
    cmd->flags		 = COMMAND_CHECK_STATE;
    eCmd.process();

    cmd->id          = CmdIgnoreText;
    cmd->text        = I18N_NOOP("Ignore this phrase");
    cmd->icon		 = NULL;
    cmd->menu_id     = MenuTextEdit;
    cmd->menu_grp    = 0x7000;
    cmd->bar_id		 = 0;
    cmd->bar_grp	 = 0;
    cmd->flags		 = COMMAND_CHECK_STATE;
    eCmd.process();

    cmd->id			 = user_data_id + 1;
    cmd->text		 = I18N_NOOP("&Filter");
    cmd->icon		 = "filter";
    cmd->menu_id	 = 0;
    cmd->menu_grp	 = 0;
    cmd->param		 = (void*)getFilterConfig;
    Event ePref(EventAddPreferences, cmd);
    ePref.process();
}
Esempio n. 8
0
ProxyPlugin::ProxyPlugin(unsigned base, Buffer *config)
        : Plugin(base)
{
    data = config;
    ProxyPacket = registerType();
    ProxyErr    = registerType();
    getContacts()->addPacketType(ProxyPacket, info.title);
}
Esempio n. 9
0
SoundPlugin::SoundPlugin(unsigned base, bool bFirst, const char *config)
        : Plugin(base)
{
    load_data(soundData, &data, config);
    soundPlugin = this;
    if (bFirst)
        playSound(getStartUp());
    user_data_id = getContacts()->registerUserData(info.title, soundUserData);

    m_bChanged = false;

    IconDef icon;
    icon.name = "sound";
    icon.xpm = sound;
    icon.isSystem = false;

    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    icon.name = "nosound";
    icon.xpm = nosound;
    eIcon.process();

    Command cmd;
    cmd->id		 = user_data_id + 1;
    cmd->text	 = I18N_NOOP("&Sound");
    cmd->icon	 = "sound";
    cmd->icon_on  = NULL;
    cmd->param	 = (void*)getSoundSetup;
    Event e(EventAddPreferences, cmd);
    e.process();

    CmdSoundDisable   = registerType();
    EventSoundChanged = registerType();

    cmd->id		  = CmdSoundDisable;
    cmd->text	  = I18N_NOOP("&Sound");
    cmd->icon	  = "nosound";
    cmd->icon_on  = "sound";
    cmd->bar_id   = ToolBarMain;
    cmd->bar_grp  = 0;
    cmd->menu_id  = 0;
    cmd->menu_grp = 0;
    cmd->flags	  = COMMAND_CHECK_STATE;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    cmd->icon	  = NULL;
    cmd->icon_on  = NULL;
    cmd->bar_id   = 0;
    cmd->menu_id  = MenuMain;
    cmd->flags	  = COMMAND_CHECK_STATE;
    eCmd.process();

    Event ePlugin(EventGetPluginInfo, (void*)"_core");
    pluginInfo *info = (pluginInfo*)(ePlugin.process());
    core = static_cast<CorePlugin*>(info->plugin);
}
Esempio n. 10
0
SoundPlugin::SoundPlugin(unsigned base, bool bFirst, Buffer *config)
        : Plugin(base)
{
    load_data(soundData, &data, config);
    soundPlugin = this;
    user_data_id = getContacts()->registerUserData(info.title, soundUserData);

    m_bChanged = false;

    CmdSoundDisable   = registerType();
    EventSoundChanged = registerType();

    Command cmd;
    cmd->id		 = user_data_id + 1;
    cmd->text	 = I18N_NOOP("&Sound");
    cmd->icon	 = "sound";
    cmd->icon_on  = NULL;
    cmd->param	 = (void*)getSoundSetup;
    Event e(EventAddPreferences, cmd);
    e.process();

    cmd->id		  = CmdSoundDisable;
    cmd->text	  = I18N_NOOP("&Sound");
    cmd->icon	  = "nosound";
    cmd->icon_on  = "sound";
    cmd->bar_id   = ToolBarMain;
    cmd->bar_grp  = 0;
    cmd->menu_id  = 0;
    cmd->menu_grp = 0;
    cmd->flags	  = COMMAND_CHECK_STATE;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    cmd->icon	  = NULL;
    cmd->icon_on  = NULL;
    cmd->bar_id   = 0;
    cmd->menu_id  = MenuMain;
    cmd->flags	  = COMMAND_CHECK_STATE;
    eCmd.process();

    Event ePlugin(EventGetPluginInfo, (void*)"_core");
    pluginInfo *info = (pluginInfo*)(ePlugin.process());
    core = static_cast<CorePlugin*>(info->plugin);

    m_sound	 = NULL;
#ifndef WIN32
    m_player = 0;
    connect(ExecManager::manager, SIGNAL(childExited(int,int)), this, SLOT(childExited(int,int)));
#endif
    m_checkTimer = new QTimer(this);
    connect(m_checkTimer, SIGNAL(timeout()), this, SLOT(checkSound()));
    if (bFirst)
        playSound(getStartUp());
}
Esempio n. 11
0
MSNPlugin::MSNPlugin(unsigned base)
        : Plugin(base)
{
    MSNPacket = registerType();
    EventAddOk   = registerType();
    EventAddFail = registerType();
    MSNInitMail  = registerType();
    MSNNewMail   = registerType();

    getContacts()->addPacketType(MSNPacket, msn_descr.text, true);

    m_protocol = new MSNProtocol(this);
}
Esempio n. 12
0
WinDockPlugin::WinDockPlugin(unsigned base, Buffer *config)
        : Plugin(base), EventReceiver(DefaultPriority - 1)
{
    dock = this;

    load_data(winDockData, &data, config);

    CmdAutoHide = registerType();

    Command cmd;
    cmd->id          = CmdAutoHide;
    cmd->text        = I18N_NOOP("AutoHide");
    cmd->menu_id     = MenuMain;
    cmd->menu_grp    = 0x7001;
    cmd->flags		= COMMAND_CHECK_STATE;

    m_bInit = false;

    m_autoHide = new QTimer(this);
    connect(m_autoHide, SIGNAL(timeout()), this, SLOT(slotAutoHide()));

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    WM_APPBAR = RegisterWindowMessageA("AppBarNotify");
    init();
}
Esempio n. 13
0
FloatyPlugin::FloatyPlugin(unsigned base)
        : Plugin(base)
{
    CmdFloaty = registerType();
    user_data_id = getContacts()->registerUserData(info.title, floatyUserData);

    IconDef icon;
    icon.name = "floating";
    icon.xpm = floating;

    m_bBlink = false;
    unreadTimer = new QTimer(this);
    connect(unreadTimer, SIGNAL(timeout()), this, SLOT(unreadBlink()));

    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    Command cmd;
    cmd->id		  = CmdFloaty;
    cmd->text	  = I18N_NOOP("Floating on");
    cmd->icon	  = "floating";
    cmd->menu_id  = MenuContact;
    cmd->menu_grp = 0xB000;
    cmd->flags	  = COMMAND_CHECK_STATE;
    Event e(EventCommandCreate, cmd);
    e.process();

    Event ePlugin(EventGetPluginInfo, (void*)"_core");
    pluginInfo *info = (pluginInfo*)(ePlugin.process());
    core = static_cast<CorePlugin*>(info->plugin);
}
Esempio n. 14
0
ActionPlugin::ActionPlugin(unsigned base)
        : Plugin(base), EventReceiver(HighPriority)
{
    plugin = this;

    action_data_id = getContacts()->registerUserData(info.title, actionUserData);
    CmdAction = registerType();

    Command cmd;
    cmd->id		 = action_data_id + 1;
    cmd->text	 = I18N_NOOP("&Action");
    cmd->icon	 = "run";
    cmd->param	 = (void*)getActionSetup;
    Event e(EventAddPreferences, cmd);
    e.process();

    cmd->id		 = CmdAction;
    cmd->text	 = "_";
    cmd->icon	 = NULL;
    cmd->flags	 = COMMAND_CHECK_STATE;
    cmd->menu_id = MenuContact;
    cmd->menu_grp = 0xC000;
    cmd->param	 = NULL;
    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    Event ePlugin(EventGetPluginInfo, (void*)"_core");
    pluginInfo *info = (pluginInfo*)(ePlugin.process());
    core = static_cast<CorePlugin*>(info->plugin);
}
void BaseGameFeatureUnit::registComponentType()
{
	FeatureUnit::registComponentType();

	auto objfactory = ObjectFactory::getInstance();
	objfactory->registerType(CREATE_CLASS_COMPONENT_INFO(AttributeComponent));
}
Esempio n. 16
0
MSNPlugin::MSNPlugin(unsigned base)
        : Plugin(base)
{
    MSNPacket = registerType();
    EventAddOk   = registerType();
    EventAddFail = registerType();

    getContacts()->addPacketType(MSNPacket, msn_descr.text, PACKET_TEXT);

    IconDef icon;
    icon.name = "MSN_online";
    icon.xpm = msn_online;
    icon.isSystem = false;

    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    icon.name = "MSN_offline";
    icon.xpm = msn_offline;
    icon.isSystem = false;
    eIcon.process();

    icon.name = "MSN_away";
    icon.xpm = msn_away;
    icon.isSystem = false;
    eIcon.process();

    icon.name = "MSN_na";
    icon.xpm = msn_na;
    icon.isSystem = false;
    eIcon.process();

    icon.name = "MSN_dnd";
    icon.xpm = msn_dnd;
    icon.isSystem = false;
    eIcon.process();

    icon.name = "MSN_invisible";
    icon.xpm = msn_invisible;
    icon.isSystem = false;
    eIcon.process();

    m_protocol = new MSNProtocol(this);
}
Esempio n. 17
0
CoreROIFactory::CoreROIFactory() {
    registerType(new ROICube());
    registerType(new ROICylinder());
    registerType(new ROISphere());
    registerType(new ROIRaster());
    registerType(new ROIUnion());
    registerType(new ROISubstract());
    registerType(new ROIGraph());
}
Esempio n. 18
0
void Engine::setAutoCast(int target, QList< int > origin, TypeCast castfunc, int prio)
{
	if(castfunc==0)return;
	if(prio<0)return;
	registerType(target);
	Private::CastFunc_s cf(prio);
	cf.cfunc=castfunc;
	cf.origin=origin;
	cf.target=target;
	d->casts.append(cf);
}
Esempio n. 19
0
YahooPlugin::YahooPlugin(unsigned base)
        : Plugin(base)
{
    Event ePlugin(EventGetPluginInfo, (void*)"_core");
    pluginInfo *info = (pluginInfo*)(ePlugin.process());
    core = static_cast<CorePlugin*>(info->plugin);
    YahooPacket = registerType();
    getContacts()->addPacketType(YahooPacket, "Yahoo!");
	registerMessages();
    m_protocol = new YahooProtocol(this);
}
Esempio n. 20
0
RsClassType& TypeSystem::getClassType(const std::string& name, size_t sz /*= 0*/, bool uniontype /*= false*/)
{
  RsClassType& entry = classMap[name];

  if (entry.invalid())
  {
    entry = RsClassType(name, sz, uniontype);
    registerType(entry);
  }

  return entry;
}
Esempio n. 21
0
/*
This method is "over generalized" to allow us to (potentially) register more types of things in
the future without adding exported symbols.
*/
int QQmlPrivate::qmlregister(RegistrationType type, void *data)
{
    if (type == TypeRegistration) {
        return registerType(*reinterpret_cast<RegisterType *>(data));
    } else if (type == InterfaceRegistration) {
        return registerInterface(*reinterpret_cast<RegisterInterface *>(data));
    } else if (type == AutoParentRegistration) {
        return registerAutoParentFunction(*reinterpret_cast<RegisterAutoParent *>(data));
    } else if (type == SingletonRegistration) {
        return registerSingletonType(*reinterpret_cast<RegisterSingletonType *>(data));
    }
    return -1;
}
Esempio n. 22
0
void registerAlgorithm(mask code, char *shortName, char *longName, 
                void (*updateWeights)(flag)) {
        Algorithm A = (Algorithm) safeMalloc(sizeof(struct algorithm), 
                        "registerAlgorithm:A");
        registerType(shortName, code, ALGORITHM);
        A->code = code;
        A->shortName = copyString(shortName);
        A->longName = copyString(longName);
        A->updateWeights = updateWeights;
        A->next = AlgorithmTable;
        AlgorithmTable = A;
        if (eval(".registerAlgorithm %s \"%s\" %d", shortName, longName, code))
                fatalError(Tcl_GetStringResult(Interp));
}
OSG_USING_NAMESPACE

/*-------------------------------------------------------------------------*/
/*                            Constructors                                 */

/*! Constructor for a new field container type.
*
*/
FieldContainerType::FieldContainerType(
    const Char8                *szName,
    const Char8                *szParentName,
    const Char8                *szGroupName,
    const UInt32                uiNameSpace,
          PrototypeCreateF      fPrototypeCreate,
          InitContainerF        fInitMethod,
          ExitContainerF        fExitMethod,
          InitalInsertDescFunc  descInsertFunc,
          bool                  bDescsAddable,
          BitVector             bvUnmarkedOnCreate,
          std::string           fcdXML,
          std::string           typeDoc) :

     Inherited       (szName,
                      szParentName,
                      szGroupName,
                      uiNameSpace,
                      descInsertFunc,
                      bDescsAddable,
                      bvUnmarkedOnCreate),


    _baseType        (IsFieldContainer  ),
    _pPrototype      (NULL              ),
    _fPrototypeCreate(fPrototypeCreate  ),
    _fInitMethod     (fInitMethod       ),
    _fExitMethod     (fExitMethod       ),
    _fcdXML          (fcdXML            ),
    _typeDoc         (typeDoc           )
{
    registerType();

    if(fInitMethod != NULL)
        fInitMethod(Static);
}
Esempio n. 24
0
SpellPlugin::SpellPlugin(unsigned base, const char *config)
        : Plugin(base)
{
    load_data(spellData, &data, config);
    m_bActive = false;
    m_base = NULL;
    CmdSpell = registerType();

    Command cmd;
    cmd->id          = CmdSpell;
    cmd->text        = "_";
    cmd->menu_id     = MenuTextEdit;
    cmd->menu_grp    = 0x0100;
    cmd->flags		 = COMMAND_CHECK_STATE;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();
    reset();
}
Esempio n. 25
0
NetmonitorPlugin::NetmonitorPlugin(unsigned base, const char *config)
        : Plugin(base)
{
    load_data(monitorData, &data, config);

    if (getLogPackets()){
        string packets = getLogPackets();
        while (packets.length()){
            string v = getToken(packets, ',');
            setLogType(atol(v.c_str()), true);
        }
    }

    monitor = NULL;
    CmdNetMonitor = registerType();

    IconDef icon;
    icon.name = "network";
    icon.xpm = network;
    icon.isSystem = false;

    Event eIcon(EventAddIcon, &icon);
    eIcon.process();

    Command cmd;
    cmd->id          = CmdNetMonitor;
    cmd->text        = I18N_NOOP("Network monitor");
    cmd->icon        = "network";
    cmd->bar_id      = ToolBarMain;
    cmd->menu_id     = MenuMain;
    cmd->menu_grp    = 0x8000;
    cmd->flags		= COMMAND_DEFAULT;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

    string value;
    CmdParam p = { "-m", I18N_NOOP("Show network monitor"), &value };
    Event e(EventArg, &p);
    if (e.process() || getShow())
        showMonitor();
}
Esempio n. 26
0
SMSPlugin::SMSPlugin(unsigned base)
        : Plugin(base)
{
    SerialPacket = registerType();
    getContacts()->addPacketType(SerialPacket, "Serial port", true);

    Command cmd;
    cmd->id			 = MessagePhoneCall;
    cmd->text		 = I18N_NOOP("Phone call");
    cmd->icon		 = "phone";
    cmd->flags		 = COMMAND_DEFAULT;
    cmd->param		 = &defPhoneCall;

    Event eMsg(EventCreateMessageType, cmd);
    eMsg.process();

    m_protocol = new SMSProtocol(this);

    qApp->installEventFilter(this);
    setPhoneCol();
}
Esempio n. 27
0
 QuantLib::Calendar Create<QuantLib::Calendar>::operator()(const std::string &id) {
     idOriginal = id;
     // Is this an ID for a Calendar or a JointCalendar?
     if (testID()) {
         // It's a JointCalendar.  Parse the ID.
         parseID();
         // Does the requested JointCalendar already exist?
         if (checkType(idFull)) {
             // It does - return it.
             return *(static_cast<QuantLib::Calendar*>(this->getType(idFull)));
         } else {
             // It doesn't - create it, add it to the registry, and return it.
             QuantLib::Calendar *jointCalendar = makeJointCalendar(calendarIDs.size());
             registerType(idFull, jointCalendar);
             return *jointCalendar;
         }
     } else {
         // the ID is for a Calendar - return it
         return *(static_cast<QuantLib::Calendar*>(this->getType(id)));
     }
 }
Esempio n. 28
0
OnTopPlugin::OnTopPlugin(unsigned base, const char *config)
        : Plugin(base)
{
    load_data(onTopData, &data, config);

    CmdOnTop = registerType();

    Command cmd;
    cmd->id          = CmdOnTop;
    cmd->text        = I18N_NOOP("Always on top");
    cmd->menu_id     = MenuMain;
    cmd->menu_grp    = 0x7000;
    cmd->flags		= COMMAND_CHECK_STATE;

    Event eCmd(EventCommandCreate, cmd);
    eCmd.process();

#if defined(WIN32) || defined (USE_KDE)
    qApp->installEventFilter(this);
#endif

    setState();
}
int main(int argc, char *argv[])
{
   c_bool isTransient, isPersistent;
   c_bool isClosed = FALSE;
   unsigned long i, j;
   os_time os_delay2000 = { 2, 0 };

   DDS_sequence_DurabilityData_Msg* DurabilityData_Msg_Seq = DDS_sequence_DurabilityData_Msg__alloc();
   DDS_SampleInfoSeq* DurabilityData_infoSeq = DDS_SampleInfoSeq__alloc();

   if( argc < 2 )
   {
      usage();
   }

   isTransient = (strcmp(argv[1], "transient") == 0) ? TRUE : FALSE;
   isPersistent = (strcmp(argv[1], "persistent") == 0) ? TRUE : FALSE;
   if( ! (isTransient || isPersistent) )
   {
      usage();
   }

   g_durability_kind = (char*) argv[1];

   // Create DDS DomainParticipant
   createParticipant("Durability example");

   // Register the Topic's type in the DDS Domain.
   g_MsgTypeSupport = DurabilityData_MsgTypeSupport__alloc();
   checkHandle(g_MsgTypeSupport, "DurabilityData_MsgTypeSupport__alloc");
   registerType(g_MsgTypeSupport);
   // Create the Topic's in the DDS Domain.
   g_MsgTypeName = (char*) DurabilityData_MsgTypeSupport_get_type_name(g_MsgTypeSupport);
   createTopic("DurabilityData_Msg", g_MsgTypeName);
   DDS_free(g_MsgTypeName);
   DDS_free(g_MsgTypeSupport);

   // Create the Subscriber's in the DDS Domain.
   createSubscriber();

   // Request a Reader from the the Subscriber.
   createReader();

   printf("=== [Subscriber] Ready ...");

   // Added a max iteration threshold in order to avoid looping infinitely.
   // This is in the case of "persistent" + auto_dispose == TRUE,
   // if the user tries to use persistence feature, it won't succeed:
   // with this setting value, the Instance is still deleted upon the delete of the Writer,
   // even though the persistent setting has been passed on both processes.
   i = 0;
   do
   {
      g_status = DurabilityData_MsgDataReader_take(
          g_DataReader,
          DurabilityData_Msg_Seq,
          DurabilityData_infoSeq,
          DDS_LENGTH_UNLIMITED,
          DDS_ANY_SAMPLE_STATE,
          DDS_ANY_VIEW_STATE,
          DDS_ANY_INSTANCE_STATE );

      checkStatus(g_status, "DurabilityData_MsgDataReader_take");

      if( DurabilityData_Msg_Seq->_length > 0 )
      {
         j = 0;
         do
         {
            if( DurabilityData_infoSeq->_buffer[j].valid_data )
            {
               printf("\n%s", DurabilityData_Msg_Seq->_buffer[j].content);
               if( strcmp(DurabilityData_Msg_Seq->_buffer[j].content, "9") == 0 )
               {
                  isClosed = TRUE;
               }
            }
         }
         while( ++j < DurabilityData_Msg_Seq->_length );

         DurabilityData_MsgDataReader_return_loan (g_DataReader, DurabilityData_Msg_Seq, DurabilityData_infoSeq);
      }
      os_nanoSleep(os_delay2000);
   }
   while( isClosed == FALSE && i++ < 5);

   // Cleanup DDS from the created Entities.
   deleteDataReader();
   deleteSubscriber();
   deleteTopic();
   deleteParticipant();

   // Cleanup C allocations, recursively freeing the allocated structures and sequences using the OpenSplice API.
   DDS_free(DurabilityData_Msg_Seq);
   DDS_free(DurabilityData_infoSeq);

   // Print out an empty line, just to let behind a clean new line for the shell..
   printf("\n");
   return 0;
}
Esempio n. 30
0
DocumentTypeManager::DocumentTypeManager () {
	registerField ("title", _("Title"), false);
	registerField ("author", _("Authors"), false);
	registerField ("journal", _("Journal"), false);
	registerField ("year", _("Year"), true);

	registerField ("volume", _("Volume"), true);
	registerField ("number", _("Issue"), true);
	registerField ("pages", _("Pages"), true);
	registerField ("month", _("Month"), true);
	registerField ("note", _("Note"), false);
	registerField ("key", _("Key"), true);

	registerField ("editor", _("Editor"), false);
	registerField ("publisher", _("Publisher"), false);
	registerField ("series", _("Series"), false);
	registerField ("address", _("Address"), false);
	registerField ("edition", _("Edition"), false);

	registerField ("booktitle", _("Book title"), false);
	registerField ("organisation", _("Organisation"), false);

	registerField ("howpublished", _("How published"), false);

	registerField ("school", _("School"), false);
	registerField ("institution", _("Institution"), false);
	registerField ("chapter", _("Chapter"), false);
	registerField ("type", _("Type"), false);
	registerField ("doi", _("DOI"), false);


	DocumentType article ("article", _("Article"));
	addField (article, "title", true);
	addField (article, "journal", true);
	addField (article, "year", true);
	addField (article, "author", true);
	addField (article, "volume", false);
	addField (article, "number", false);
	addField (article, "pages", false);
	addField (article, "doi", false);
	// Fields John thinks are silly
	/*
	addField (article, "month", false);
	addField (article, "note", false);
	addField (article, "key", false);
	*/
	registerType (article);

	DocumentType book ("book", _("Book"));
	addField (book, "author", true);
	addField (book, "editor", true);
	addField (book, "title", true);
	addField (book, "publisher", true);
	addField (book, "year", true);
	addField (book, "volume", false);
	addField (book, "series", false);
	addField (book, "address", false);
	addField (book, "edition", false);
	addField (book, "doi", false);
	// Fields John thinks are silly
	/*
	addField (book, "month", false);
	addField (book, "note", false);
	addField (book, "key", false);
	*/
	registerType (book);

	DocumentType inproceedings ("inproceedings", _("In Proceedings"));
	addField (inproceedings, "author", true);
	addField (inproceedings, "title", true);
	addField (inproceedings, "booktitle", true);
	addField (inproceedings, "year", true);
	addField (inproceedings, "editor", false);
	addField (inproceedings, "pages", false);
	addField (inproceedings, "organisation", false);
	addField (inproceedings, "publisher", false);
	addField (inproceedings, "address", false);
	addField (inproceedings, "doi", false);
	/*
	addField (inproceedings, "month", false);
	addField (inproceedings, "note", false);
	addField (inproceedings, "key", false);
	*/
	registerType (inproceedings);

	DocumentType misc ("misc", _("Misc"));
	addField (misc, "author", false);
	addField (misc, "title", false);
	addField (misc, "howpublished", false);
	addField (misc, "month", false);
	addField (misc, "year", false);
	addField (misc, "note", false);
	addField (misc, "key", false);
	addField (misc, "doi", false);
	registerType (misc);
	
	DocumentType unpublished ("unpublished", _("Unpublished"));
	addField (unpublished, "author", true);
	addField (unpublished, "title", true);
	addField (unpublished, "note", true);
	addField (unpublished, "month", false);
	addField (unpublished, "year", false);
	addField (unpublished, "key", false);
	addField (unpublished, "doi", false);
	registerType (unpublished);

	DocumentType mastersthesis ("mastersthesis", _("Master's thesis"));
	addField (mastersthesis, "author", true);
	addField (mastersthesis, "title", true);
	addField (mastersthesis, "school", true);
	addField (mastersthesis, "year", true);
	addField (mastersthesis, "address", false);
	addField (mastersthesis, "note", false);
	addField (mastersthesis, "month", false);
	addField (mastersthesis, "key", false);
	addField (mastersthesis, "doi", false);
	registerType (mastersthesis);

	DocumentType phdthesis ("phdthesis", _("PhD thesis"));
	addField (phdthesis, "author", true);
	addField (phdthesis, "title", true);
	addField (phdthesis, "school", true);
	addField (phdthesis, "year", true);
	addField (phdthesis, "address", false);
	addField (phdthesis, "note", false);
	addField (phdthesis, "month", false);
	addField (phdthesis, "key", false);
	addField (phdthesis, "doi", false);	
	registerType (phdthesis);

	DocumentType proceedings ("proceedings", _("Proceedings"));
	addField (proceedings, "title", true);
	addField (proceedings, "year", true);
	addField (proceedings, "editor", false);
	addField (proceedings, "publisher", false);
	addField (proceedings, "organisation", false);
	addField (proceedings, "address", false);
	addField (proceedings, "month", false);
	addField (proceedings, "note", false);
	addField (proceedings, "key", false);
	addField (proceedings, "doi", false);	
	registerType (proceedings);

	DocumentType conference ("conference", _("Conference"));
	addField (conference, "title", true);
	addField (conference, "author", false);
	addField (conference, "howpublished", false);
	addField (conference, "address", false);
	addField (conference, "month", false);
	addField (conference, "year", false);
	addField (conference, "note", false);
	addField (conference, "key", false);
	addField (conference, "doi", false);	
	registerType (conference);

	DocumentType inbook ("inbook", _("In Book"));
	addField (inbook, "title", true);
	addField (inbook, "editor", true);
	addField (inbook, "author", true);
	addField (inbook, "chapter", true);
	addField (inbook, "pages", true);
	addField (inbook, "publisher", true);
	addField (inbook, "year", true);
	addField (inbook, "volume", false);
	addField (inbook, "series", false);
	addField (inbook, "address", false);
	addField (inbook, "edition", false);
	addField (inbook, "month", false);
	addField (inbook, "note", false);
	addField (inbook, "key", false);
	addField (inbook, "doi", false);
	registerType (inbook);

	DocumentType booklet ("booklet", _("Booklet"));
	addField (booklet, "title", true);
	addField (booklet, "author", false);
	addField (booklet, "howpublished", false);
	addField (booklet, "address", false);
	addField (booklet, "month", false);
	addField (booklet, "year", false);
	addField (booklet, "note", false);
	addField (booklet, "key", false);
	addField (booklet, "doi", false);
	registerType (booklet);

	DocumentType incollection ("incollection", _("In Collection"));
	addField (incollection, "author", true);
	addField (incollection, "title", true);
	addField (incollection, "booktitle", true);
	addField (incollection, "year", true);
	addField (incollection, "editor", false);
	addField (incollection, "pages", false);
	addField (incollection, "organisation", false);
	addField (incollection, "publisher", false);
	addField (incollection, "address", false);
	addField (incollection, "month", false);
	addField (incollection, "note", false);
	addField (incollection, "key", false);
	addField (incollection, "doi", false);
	registerType (incollection);

	DocumentType manual ("manual", _("Manual"));
	addField (manual, "title", true);
	addField (manual, "author", false);
	addField (manual, "organisation", false);
	addField (manual, "address", false);
	addField (manual, "edition", false);
	addField (manual, "month", false);
	addField (manual, "year", false);
	addField (manual, "note", false);
	addField (manual, "key", false);
	addField (manual, "doi", false);
	registerType (manual);

	DocumentType techreport ("techreport", _("Technical Report"));
	addField (techreport, "title", true);
	addField (techreport, "author", true);
	addField (techreport, "institution", true);
	addField (techreport, "year", true);
	addField (techreport, "type", false);
	addField (techreport, "number", false);
	addField (techreport, "address", false);
	addField (techreport, "month", false);
	addField (techreport, "note", false);
	addField (techreport, "key", false);
	addField (techreport, "doi", false);
	registerType (techreport);

}