2010-07-13 Dario Rodriguez <dario.rodriguez@artica.es>
* pandora_agent_conf.cc: Added support to parse collections * pandora_agent_conf.h: Added support to parse collections git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3002 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
52c019637f
commit
76e22972cf
|
@ -1,3 +1,8 @@
|
||||||
|
2010-07-13 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||||
|
|
||||||
|
* pandora_agent_conf.cc: Added support to parse collections
|
||||||
|
* pandora_agent_conf.h: Added support to parse collections
|
||||||
|
|
||||||
2010-07-12 Ramon Novoa <rnovoa@artica.es>
|
2010-07-12 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* modules/pandora_module.h, modules/pandora_module_factory.cc,
|
* modules/pandora_module.h, modules/pandora_module_factory.cc,
|
||||||
|
|
|
@ -20,15 +20,19 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "pandora_agent_conf.h"
|
#include "pandora_agent_conf.h"
|
||||||
|
#include "pandora_strutils.h"
|
||||||
|
#include <iostream>
|
||||||
#include "pandora.h"
|
#include "pandora.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Pandora;
|
using namespace Pandora;
|
||||||
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define MAX_KEYS 100
|
#define MAX_KEYS 100
|
||||||
|
|
||||||
Pandora::Pandora_Agent_Conf::Pandora_Agent_Conf () {
|
Pandora::Pandora_Agent_Conf::Pandora_Agent_Conf () {
|
||||||
this->key_values = NULL;
|
this->key_values = NULL;
|
||||||
|
this->collection_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +40,7 @@ Pandora::Pandora_Agent_Conf::Pandora_Agent_Conf () {
|
||||||
*/
|
*/
|
||||||
Pandora::Pandora_Agent_Conf::~Pandora_Agent_Conf () {
|
Pandora::Pandora_Agent_Conf::~Pandora_Agent_Conf () {
|
||||||
delete key_values;
|
delete key_values;
|
||||||
|
delete collection_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pandora_Agent_Conf *
|
Pandora_Agent_Conf *
|
||||||
|
@ -69,6 +74,10 @@ Pandora::Pandora_Agent_Conf::setFile (string filename) {
|
||||||
delete this->key_values;
|
delete this->key_values;
|
||||||
this->key_values = new list<Key_Value> ();
|
this->key_values = new list<Key_Value> ();
|
||||||
|
|
||||||
|
if (this->collection_list)
|
||||||
|
delete this->collection_list;
|
||||||
|
this->collection_list = new list<string> ();
|
||||||
|
|
||||||
if (!file.is_open ()) {
|
if (!file.is_open ()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +89,19 @@ Pandora::Pandora_Agent_Conf::setFile (string filename) {
|
||||||
|
|
||||||
/* Ignore blank or commented lines */
|
/* Ignore blank or commented lines */
|
||||||
if (buffer[0] != '#' && buffer[0] != '\n' && buffer[0] != '\0') {
|
if (buffer[0] != '#' && buffer[0] != '\n' && buffer[0] != '\0') {
|
||||||
|
/*Check if is a collection*/
|
||||||
|
pos = buffer.find("file_collection");
|
||||||
|
if(pos != string::npos) {
|
||||||
|
string collection_name, trimmed_str;
|
||||||
|
|
||||||
|
/*Add collection to collection_list*/
|
||||||
|
/*The number 15 is the number of character of string file_collection*/
|
||||||
|
collection_name = buffer.substr(pos+15);
|
||||||
|
trimmed_str = trim (collection_name);
|
||||||
|
collection_list->push_back (trimmed_str);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/*Check if is a module*/
|
||||||
pos = buffer.find ("module_");
|
pos = buffer.find ("module_");
|
||||||
if (pos == string::npos) {
|
if (pos == string::npos) {
|
||||||
Key_Value kv;
|
Key_Value kv;
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace Pandora {
|
||||||
class Pandora_Agent_Conf {
|
class Pandora_Agent_Conf {
|
||||||
private:
|
private:
|
||||||
list<Key_Value> *key_values;
|
list<Key_Value> *key_values;
|
||||||
|
list<string> *collection_list;
|
||||||
|
|
||||||
Pandora_Agent_Conf ();
|
Pandora_Agent_Conf ();
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue