impl unit loading in task
							parent
							
								
									27257f98e1
								
							
						
					
					
						commit
						2724cf71a4
					
				| 
						 | 
				
			
			@ -1,7 +1,16 @@
 | 
			
		|||
{
 | 
			
		||||
  "units": [
 | 
			
		||||
    {
 | 
			
		||||
      "name":       "independent test",
 | 
			
		||||
      "name":       "independent test 1",
 | 
			
		||||
      "target":     "/bin/pwd",
 | 
			
		||||
      "output":     "pass",
 | 
			
		||||
      "rectifier":  "/bin/pwd",
 | 
			
		||||
      "active":     true,
 | 
			
		||||
      "required":   true,
 | 
			
		||||
      "rectify":    true
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name":       "independent test 2",
 | 
			
		||||
      "target":     "/bin/pwd",
 | 
			
		||||
      "output":     "pass",
 | 
			
		||||
      "rectifier":  "/bin/pwd",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,9 +39,21 @@ void Task::load_root(Json::Value loader_root, bool verbose )
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Task::get_name - Retrieves the name of the current Task.
 | 
			
		||||
std::string Task::get_name()
 | 
			
		||||
{
 | 
			
		||||
    return this->name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// Task::load_definition - Loads a unit to a local member.  Used to tie Units to Tasks.
 | 
			
		||||
///
 | 
			
		||||
/// \param selected_unit - The unit to attach.
 | 
			
		||||
/// \param verbose - Whether to print to STDOUT.
 | 
			
		||||
void Task::load_definition( Unit selected_unit, bool verbose )
 | 
			
		||||
{
 | 
			
		||||
    this->definition = selected_unit;
 | 
			
		||||
    if ( verbose )
 | 
			
		||||
    {
 | 
			
		||||
        std::cout << "Loaded definition \"" << selected_unit.get_name() << "\" for task \"" << this->get_name() << "\"." << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -28,12 +28,8 @@ class Task
 | 
			
		|||
        // load a json::value into task members (second stage deserialization)
 | 
			
		||||
        void load_root( Json::Value loader_root, bool verbose );
 | 
			
		||||
 | 
			
		||||
        // register a dependency
 | 
			
		||||
        void add_dependency( std::string dependency_name );
 | 
			
		||||
 | 
			
		||||
        // appends definition unit as child member
 | 
			
		||||
        void load_definition( Unit definition );
 | 
			
		||||
 | 
			
		||||
        void load_definition( Unit definition, bool verbose );
 | 
			
		||||
 | 
			
		||||
        bool is_complete();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue