Introduction Manual Class Reference Header Reference

Layer 1: Base Initialization

The ZoidCom Object

The first thing to do before using Zoidcom in your app is creating and initializing the ZoidCom object.

    // this is needed in every sourcefile using zoidcom
    #include <zoidcom.h>

    int main()
    {
      // create ZoidCom with logging disabled
      ZoidCom *zcom = new ZoidCom();
      if (!zcom)
        exit(255);

      // initialize
      if (!zcom->Init())
        exit(255);

      // here Zoidcom can be used

      // remove it again
      delete zcom;
    }

There are three constructors for ZoidCom, one has no parameters, another one accepts a filename as logoutput, and the last one accepts a function pointer as logoutput. With latter one, you can hook Zoidcom into your own logging facilities and apply filters, or just write it out to a file yourself.

Note that it is essential to delete all ZCom_Control instances before deleting the ZoidCom object, because ZCom_Control needs ZoidCom to operate.

Logging To A File

If Zoidcom's logging should go to a file, the ZoidCom object just needs the filename:

    ZoidCom *zcom = new ZoidCom("zoidcomlog.txt");

Custom Logging

If Zoidcom's logging should be processed by your application, a C function needs to be defined:

    void process_zoidcom_log(const char *_log) {
      printf("%s\n", _log);
    }

And then during Zoidcom init:

    ZoidCom *zcom = new ZoidCom(process_zoidcom_log);

This will give all logs to the function process_zoidcom_log() which in turn prints them to standard output.


This file is part of the documentation for Zoidcom. Documentation copyright © 2004-2008 by Jörg Rüppel. Generated on Sat Aug 16 15:26:51 2008 for Zoidcom by doxygen 1.4.6-NO