FiReS - property management for Filtering, Retrieval and Search
(c) 2014 - 2020. VGLAB / VG-Lab / URJC / UPM
www.vglab.es www.vg-lab.es vg-la.nosp@m.b@vg.nosp@m.-lab..nosp@m.es
Introduction
FiReS is a library that allow registering type-independent properties in objects. FiReS also provides tasks that can use the registered properties for filtering, search, sorting operations over a set of objects.
Dependencies
Boost.Any, Boost.Lexical_Cast, Boost.property_tree and Boost.Spirit are the only required dependencies.
OpenMP and Boost's Unit Test Framework are optional.
Building
FiReS has been succesfully built and used on Ubuntu 16.04, Mac OSX Yosemite and Windows 7/8/10 (Visual Studio 2015 Win64). The following steps should be enough to build it:
1 git clone https://github.com/vg-lab/FiReS.git
2 mkdir FiReS/build && cd FiReS/build
3 cmake .. -DCMAKE_BUILD_TYPE=Release
How to use it
### Registering properties
2 class MyClass : public fires::Object
7 myObject.registerProperty( "property1", 3.0f );
8 myObject.registerProperty( "property2", int( 2 ));
### Retrieving properties
2 float v1 = myObject.getProperty( "property1" ).value( );
3 int v2 = myObject.getProperty( "property2" ).value( );
### Creating notifier/observer
2 class MyClass : public fires::Object
5 FIRES_OBSERVER_CALLBACK( observerCallback, notifier, propertyLabel )
7 std::cout << label( ) << ": Hey!" << " object " << notifier->label( )
8 << " updated " << propertyLabel << " to "
9 << notifier->getProperty( "p1" ).value< int >( ) << std::endl;
16 o1.registerProperty( "p1", 1 );
17 fires::ObserverManager::addObserver( &o1, "p1", &o2, &MyClass::observerCallback );
18 o1.setProperty( "p1", 2 );
20 // o2: Hey! object o1 updated p1
Sorting
2 class MyClass : public fires::Object
9 MyClass o1, o2, o3, o4;
12 fires::SortConfig sortConfig;
13 fires::ScalarPropertySorter< float > sfsf;
17 o1.registerProperty( "p1", 3.1f );
18 o2.registerProperty( "p1", 4.1f );
19 o3.registerProperty( "p1", 1.2f );
20 o4.registerProperty( "p1", 3.1f );
22 // Create the objects container
23 objs.addList( { &o1, &o2, &o3, &o4 } );
25 // Configure sort config
26 sortConfig.addProperty( "p1", &sfsf );
29 sorter.eval( objs, sortConfig );