cy-cxxfwk / lib / lib.cxx

#include "Python.h"
#include "lib.h"

#include <iostream>

IAlg::~IAlg()
{}

IAlg::IAlg()
{}

class Alg : public IAlg
{
public:
  Alg();
  ~Alg();

  void run();
};

Alg::Alg()
{
  std::cout << ":: Alg::Alg()...\n";
}

Alg::~Alg()
{
  std::cout << ":: Alg::~Alg()...\n";
}

void
Alg::run()
{
  std::cout << ":: Alg::run()...\n";
}

IAlg *create_alg(int algid)
{
  switch (algid) {
  case 0:
    return new Alg;
  case 1:
    return 0;
  default:
    return 0;
  }

  return 0;
}

CyAlgBase::CyAlgBase(PyObject *obj, RunFct fct) :
  obj(obj),
  fct(fct)
{
  Py_XINCREF(this->obj);
}

CyAlgBase::~CyAlgBase()
{
  Py_XDECREF(this->obj);
}

void
CyAlgBase::run()
{
  std::cout << "::CyAlgBase::run()...\n";
  if (this->obj && this->fct) {
    return this->fct(this->obj);
  }
  std::cerr << "** invalid cy-state: obj [" << this->obj << "] fct: ["
            << this->fct << "]\n";
  return;
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.