[Dec '10] Coming soon: Pantheios.Net. The same technology that allows Pantheios (C++) to be robust, succinct, extensible and highly efficient, applied to the .NET platform. Watch this space ... (or get in contact)

Pantheios

 Pantheios

 

Tutorials: Front-ends

Using the Stock fe.simple Front-end

Using the stock fe.simple front-end involves two simple steps. First, you must link to it.

If you're using explicit linking, then you need to specify the requisite library name to the linker. For example, if you're using the Visual C++ 7.1 compiler, and are building for the static multithreaded runtime library, you would link to
  pantheios.1.fe.simple.vc71.mt.debug.lib
for debug builds, or
  pantheios.1.fe.simple.vc71.mt.lib
for release builds.

Alternatively, if you're using implicit linking, then you need to include the fe.simple header file:
  #include <pantheios/implicit_link/fe.simple.h>
When you build the project linked to fe.simple, you will receive a linker error complaining about FE_SIMPLE_PROCESS_IDENTITY. This is the symbol that the fe.simple library's pantheios_fe_processIdentity() is implemented in terms of. To resolve the link error, and define your process's identity, simply define this as follows:
  PANTHEIOS_EXTERN_C const char FE_SIMPLE_PROCESS_IDENTITY[] = "My-Process";
Note: the process-identity may not contain whitespace.

Implementing and Linking a Custom Front-end

Implementing your own custom front-end can be extremely simple. The absolute minimum implementation requires nothing more than a non-NULL nul-terminated string returned from pantheios_fe_processIdentity(), a non-zero return value from pantheios_fe_isSeverityLogged(), and effectively stub'd forms of pantheios_fe_init() and pantheios_fe_uninit(), as follows:
PANTHEIOS_CALL(int) pantheios_fe_init(void*   reserved
                                    , void**  ptoken)
{
  *ptoken = NULL;

  return 0;
}

PANTHEIOS_CALL(void) pantheios_fe_uninit(void* token)
{}

PANTHEIOS_CALL(char const*) pantheios_fe_processIdentity(void* token)
{
  return "My Process";
}

PANTHEIOS_CALL(int) pantheios_fe_isSeverityLogged(void* token
                                                , int   severity
                                                , int   backEndId)
{
  return 1; // Allow all levels
}
The sophistication of the front-end is entirely at your whim. Suppose that you have (as we have had in several projects that use Pantheios) an API that defines a shared memory region that can be used to filter severity levels on a runtime basis:
  typedef shared_region_t_ *shared_region_t;

  shared_region_t acquire_shared_region(char const* processIdentity);
  void            release_shared_region(shared_region_t rs);
  int             read_shared_region_severity(shared_region_t rs, int severity);
Such an API can be readily incorporated into a Pantheios front-end library, as follows:
PANTHEIOS_CALL(int) pantheios_fe_init(void*   reserved
                                    , void**  ptoken)
{
  shared_region_t sr = acquire_shared_region("My Process");

  if(NULL == sr)
  {
    return -1; // Cause Pantheios initialisation to fail
  }

  *ptoken = sr;

  return 0;
}

PANTHEIOS_CALL(void) pantheios_fe_uninit(void* token)
{
  release_shared_region((shared_region_t)token);
}

PANTHEIOS_CALL(char const*) pantheios_fe_processIdentity(void* token)
{
  return "My Process";
}

PANTHEIOS_CALL(int) pantheios_fe_isSeverityLogged(void* token
                                                , int   severity
                                                , int   backEndId)
{
  return read_shared_region_severity((shared_region_t)token, severity);
}


The above example does not show filtering of severity level based on the back-end identifier, but this can be incorporated by making use of the backEndId parameter. When using the be.lrsplit back-end, the backEndId may be PANTHEIOS_BEID_ALL (0) to enquire whether any emission may be performed, or PANTHEIOS_BEID_LOCAL (1) to enquire whether emission via the local back-end may be performed, or PANTHEIOS_BEID_REMOTE (2) to enquire whether emission via the remote back-end may be performed.

See also

  • Essentials - essential facts you need to know about Pantheios to get up and running.
  • Pantheios Architecture - introduction to the four parts of the Pantheios architecture: Application Layer, Core, Front-end, Back-ends.
  • Downloads - download the Pantheios library (source and binaries), samples, tools and dependent projects.
  • Tutorials - tutorials on using the Pantheios library.
  • Related Material - read up on the concepts of Shims & Type Tunneling, on the STLSoft auto_buffer class, on namespace aliasing, and more ...
  • API Documentation - once you've familiarised yourself with Pantheios via the tutorials, use the online documentation for fine details on the API functions and types.
  • Project Members - see who is implementing Pantheios, and how you can help out.
  • Performance - performance tests, which demonstrate the claimed peerless performance of Pantheios.
  • Future Directions - features that are anticipated/planned, but not yet implemented.
 

Links

Support This Project

Copyright (c) 1999-2010 Synesis Software Pty Ltd

Valid XHTML 1.0 Transitional