// $RCSfile: ServicesFactory.cpp,v $
#include "ServicesFactory.h"
#include <stdlib.h>

#include "SAPAccountingAdapter.h"
#include "TopAccountingAdapter.h"

AccountingAdapter *
 ServicesFactory::getAccountingAdapter()
{
  const char *sysname
    = getenv("ACCOUNTINGSYSTEM");

  if (strcmp(sysname,"SAP") == 0) {
    return new SAPAccountingAdapter();
  } else if (strcmp(sysname,"Top") == 0) {
    return new TopAccountingAdapter();
  } else {
    // ...
    return 0;
  }
}

ServicesFactory *
ServicesFactory::Instance() {
  if (_instance == 0) {
    _instance = new ServicesFactory();
  }
  return _instance;
}

// need to initialize _instance so the
// Instance method has somewhere to start
ServicesFactory *
ServicesFactory::_instance = 0;
