

#ifndef CRIMILD_CORE_BEHAVIORS_COMPOSITES_PARALLEL_
#define CRIMILD_CORE_BEHAVIORS_COMPOSITES_PARALLEL_

#include "Composite.hpp"

namespace crimild {

	namespace behaviors {

		namespace composites {

			/**
			   \brief Execute all children concurrently

			   In each step, all children that are active (that is, not finished)
			   are executed. Initialization happens concurrently too.
			   
			   This behavior succeedes only if all of its children do.
			*/
			class Parallel : public Composite {
				CRIMILD_IMPLEMENT_RTTI( crimild::behaviors::composites::Parallel )
				
			public:
				explicit Parallel( void );
				virtual ~Parallel( void );
				
				virtual void init( BehaviorContext *context ) override;
				
				virtual Behavior::State step( BehaviorContext *context ) override;

			private:
				std::vector< Behavior::State > _states;
			};

		}

	}
	
}

#endif

