FF4 - Snapshot

- Sketched out Filter
- Implemented part of TDB
This commit is contained in:
Paul Beckingham 2009-05-19 01:38:05 -04:00
parent f97dff0125
commit e754fa6eac
9 changed files with 34 additions and 15 deletions

View file

@ -152,14 +152,24 @@ bool Att::internal () const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TODO Encode values prior to serialization. // Encode values prior to serialization.
// \t -> &tab;
// " -> "
// , -> ,
// [ -> &open;
// ] -> &close;
void Att::encode (std::string&) const void Att::encode (std::string&) const
{ {
throw std::string ("unimplemented Att::internal"); throw std::string ("unimplemented Att::internal");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TODO Decode values after parse. // Decode values after parse.
// \t <- &tab;
// " <- &quot;
// , <- &comma;
// [ <- &open;
// ] <- &close;
void Att::decode (std::string&) const void Att::decode (std::string&) const
{ {
throw std::string ("unimplemented Att::internal"); throw std::string ("unimplemented Att::internal");

View file

@ -80,8 +80,8 @@ Context::~Context ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Context::initialize (int argc, char** argv) void Context::initialize (int argc, char** argv)
{ {
// Load the config file from the home directory. If the file cannot be // Load the configuration file from the home directory. If the file cannot
// found, offer to create a sample one. // be found, offer to create a sample one.
loadCorrectConfigFile (argc, argv); loadCorrectConfigFile (argc, argv);
// When redirecting output to a file, do not use color, curses. // When redirecting output to a file, do not use color, curses.

View file

@ -59,15 +59,20 @@ Filter::~Filter ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Filter::add (Att& att) void Filter::add (Att& att)
{ {
throw std::string ("unimplemented Filter::add");
mAtts.push_back (att); mAtts.push_back (att);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Filter::pass (T&) bool Filter::pass (Record& record)
{ {
throw std::string ("unimplemented Filter::pass"); throw std::string ("unimplemented Filter::pass");
return false; /*
foreach (att, mAtts)
if (! att->match (record))
return false;
*/
return true;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -29,7 +29,7 @@
#include <vector> #include <vector>
#include "Att.h" #include "Att.h"
#include "T.h" #include "Record.h"
class Filter class Filter
{ {
@ -40,7 +40,7 @@ public:
~Filter (); // Destructor ~Filter (); // Destructor
void add (Att&); void add (Att&);
bool pass (T&); bool pass (Record&);
private: private:
std::vector <Att> mAtts; std::vector <Att> mAtts;

View file

@ -37,7 +37,6 @@ Sequence::Sequence ()
Sequence::Sequence (const Sequence& other) Sequence::Sequence (const Sequence& other)
{ {
throw std::string ("unimplemented Sequence::Sequence"); throw std::string ("unimplemented Sequence::Sequence");
mSequence = other.mSequence;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -46,7 +45,6 @@ Sequence& Sequence::operator= (const Sequence& other)
throw std::string ("unimplemented Sequence::operator="); throw std::string ("unimplemented Sequence::operator=");
if (this != &other) if (this != &other)
{ {
mSequence = other.mSequence;
} }
return *this; return *this;

View file

@ -30,7 +30,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
class Sequence class Sequence : public std::vector <int>
{ {
public: public:
Sequence (); // Default constructor Sequence (); // Default constructor
@ -39,9 +39,6 @@ public:
~Sequence (); // Destructor ~Sequence (); // Destructor
void parse (const std::string&); void parse (const std::string&);
private:
std::vector <int> mSequence;
}; };
#endif #endif

View file

@ -66,6 +66,7 @@ T::~T ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// [name:value, name:"value",name:[name:value,name:value]]
std::string T::composeF4 () std::string T::composeF4 ()
{ {
throw std::string ("unimplemented T::composeF4"); throw std::string ("unimplemented T::composeF4");

View file

@ -148,6 +148,10 @@ void TDB::unlock ()
int TDB::load (std::vector <T>& tasks, Filter& filter) int TDB::load (std::vector <T>& tasks, Filter& filter)
{ {
throw std::string ("unimplemented TDB::load"); throw std::string ("unimplemented TDB::load");
// TODO Read each row.
// TODO Let T::parse disassemble it.
// TODO If task passes filter, add to tasks.
return 0; return 0;
} }
@ -156,6 +160,9 @@ int TDB::load (std::vector <T>& tasks, Filter& filter)
void TDB::add (T& after) void TDB::add (T& after)
{ {
throw std::string ("unimplemented TDB::add"); throw std::string ("unimplemented TDB::add");
// TODO Seek to end of pending.
// TODO write after.composeFF4 ().
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -21,6 +21,7 @@ int main (int argc, char** argv)
catch (...) catch (...)
{ {
std::cerr << "task internal error." << std::endl;
} }
return -1; return -1;