main.cpp File Reference

Custom Database sample program. More...

#include <string>
#include <set>
#include <iostream>
#include <fstream>
#include <ctime>
#include "dca/dca_base.h"
#include "dca/dca_customdb_toolbox.h"
#include "dca/dca_callbacks.h"

Go to the source code of this file.


#define DCA_BINDIR   "bin/linux"
 DCA subdirectory of the DCA binaries.
#define DCA_INITDIR   "init"
 DCA subdirectory of the DCA initialization data.
#define DCA_LOGDIR   "./logs"
 Relative directory for logfile(s).


static void SetupInitData (const std::string &redist_folder, InitData &initData)
 Sets up the given initData by substituting the given redist_folder with DCA subdirectories.
static void SetupLicense (const std::string &ticket, const std::string &product, LicenseData &licenseData)
 Sets up the given licenseData by copying the given ticket and product strings.
static void SetupConnectionData (const std::string &custom_db_folder, DbConnectionData &cData)
 Sets up the given cData to use a custom URL database.
static void PrintToolHeader ()
 Prints out the name and the version of this sample.
static void PrintUsage (const char *name)
 Prints out the syntax of the sample.
static void PrintLicenseInfo (const License &aLicense)
 Prints out the information about the provided License.
static void PrintCategoriesInfo (const CategoriesInfo &myCategoriesInfo)
 Prints out the contents of the given myCategoriesInfo.
static void PrintUrlResult (const std::string &myUrlString, const std::set< int > &myCatSet)
 Simple routine that prints out all found categories for the given URL string.
void InitializeCustomDatabase (const DcaInstance &aDca, const License &aLicense, UrlCustomDb &myUrlCustomDb)
 Initialize all classes that are used to create the UrlCustomDb instance, and return the initialized myUrlCustomDb to the caller.
int ProcessCustomDatabase (const DcaInstance &aDca, const License &aLicense)
 First calls InitializeCustomDatabase() with given parameters and then takes the following steps:

  • add an URL with categorizations to the custom database
  • retrieve the categories for that URL and print them out
  • removs the URL from the custom database
  • retry to retrieve the previously removed URL.

int main (int argc, char *argv[])
 The main routine.


const std::string S_ToolName = "customdbsample"
const std::string S_ToolVersion = "1.2"
std::string custom_db_folder
std::string categories_folder
const std::string S_UsageString
 Usage string, displayed if a parameter is missing.

Detailed Description

Custom Database sample program.

Definition in file customdb_samples/customdbsample/main.cpp.

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1