Skip to content

Commit

Permalink
yasmine 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SeadexTM authored Aug 18, 2017
1 parent 05660a3 commit c4ad90a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 35 deletions.
28 changes: 14 additions & 14 deletions libyasmine/source/async_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void async_state_machine::halt_and_join()
{
SX_LOG( hermes::log_level::LL_INFO, "Stopping and joining async state machine '%'.", get_name() );

halt();
join();
halt();
join();

SX_LOG( hermes::log_level::LL_INFO, "Stopped and joined async state machine '%'.", get_name() );
}
Expand All @@ -104,7 +104,7 @@ void async_state_machine::halt()
"Status is not 'STARTED' or 'TERMINATED' on stop!" );
status_ = state_machine_status::STOP_REQUESTED;
}
run_and_event_condition_.notify_one();
run_and_event_condition_.notify_one();

SX_LOG( hermes::log_level::LL_TRACE, "Stopped state machine '%'.", get_name() );
}
Expand All @@ -121,7 +121,7 @@ void async_state_machine::join()
}

worker_thread_->join();
worker_thread_.reset();
worker_thread_.reset();
status_ = state_machine_status::STOPPED;
state_machine_base::halt();

Expand Down Expand Up @@ -169,10 +169,10 @@ bool async_state_machine::push( const event_sptr& _event )
void async_state_machine::start_state_machine()
{
SX_ASSERT( ( state_machine_status::NEW == status_ ) || ( state_machine_status::STOPPED == status_ ),
"Status is neither 'NEW' nor 'STOPPED' on start!" );
"Status is neither 'NEW' nor 'STOPPED' on start!" );

status_ = state_machine_status::STARTED;
worker_thread_ = SX_MAKE_UNIQUE< sxe::thread >( &async_state_machine::work, this );
status_ = state_machine_status::STARTED;
worker_thread_ = SX_MAKE_UNIQUE< sxe::thread >( &async_state_machine::work, this );
}


Expand All @@ -182,16 +182,16 @@ bool async_state_machine::insert( const event_sptr& _event )

bool event_added = false;
{
sxe::lock_guard< sxe::mutex > lock( run_and_event_mutex_ );
sxe::lock_guard< sxe::mutex > lock( run_and_event_mutex_ );
if( status_ == state_machine_status::STARTED )
{
{
insert_impl( _event );
event_added = true;
}
else
{
SX_LOG( hermes::log_level::LL_WARN, "Event '%' was not inserted in the queue of events! State machine is not running.", _event->get_name() );
}
}
}
if( event_added )
{
Expand All @@ -214,7 +214,7 @@ void async_state_machine::insert_impl( const event_sptr& _event )
event_list_.push_back( _event );
}
else
{
{
std::list< event_sptr >::iterator position = event_list_.begin();
while( position != event_list_.end() )
{
Expand All @@ -225,13 +225,13 @@ void async_state_machine::insert_impl( const event_sptr& _event )
++position;
}
SX_ASSERT( position != event_list_.end(), "No element found before which to insert!" );
event_list_.insert( position, _event );
event_list_.insert( position, _event );
}
}


bool async_state_machine::wait_predicate() const
{
{
return( !( status_ == state_machine_status::STARTED ) || !event_list_.empty() );
}

Expand Down
14 changes: 7 additions & 7 deletions libyasmine/source/state_pseudostate_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ state_pseudostate_impl::state_pseudostate_impl( const std::string& _name )
#ifdef Y_OPTIMIZE_4_SPEED
ancestors_as_regions_.reserve( ANCESTORS_VECTOR_SIZE );
ancestors_.reserve( ANCESTORS_VECTOR_SIZE );
#endif
#endif
}


state_pseudostate_impl::~state_pseudostate_impl() SX_NOEXCEPT
{
// Nothing to do...
}


const state_machine_element* state_pseudostate_impl::get_parent() const
{
Expand Down Expand Up @@ -73,7 +73,7 @@ raw_composite_states state_pseudostate_impl::get_ancestors( composite_state* con
raw_composite_states ancestors;
collect_ancestors( ancestors, _final_ancestor, _include_final_ancestor );
return( ancestors );
#endif
#endif
}


Expand All @@ -86,8 +86,8 @@ raw_regions state_pseudostate_impl::get_ancestors_as_regions() const
}
return( ancestors_as_regions_ );
#else
return( get_parent_state().get_ancestors_as_regions() );
#endif
return( get_parent_state().get_ancestors_as_regions() );
#endif
}


Expand All @@ -98,8 +98,8 @@ void state_pseudostate_impl::collect_ancestors( raw_composite_states& _ancestors
const raw_composite_states& ancestors_of_parent_state = get_parent_state().get_ancestors( _final_ancestor );
_ancestors.insert( _ancestors.end(), ancestors_of_parent_state.begin(), ancestors_of_parent_state.end() );
if( !_include_final_ancestor )
{
_ancestors.erase( _ancestors.end() );
{
_ancestors.erase( _ancestors.end() );
}
}

Expand Down
2 changes: 1 addition & 1 deletion libyasmine/source/timed_event_creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ handle_type timed_event_creator::create_event_creation_request(
sxe::unique_lock< sxe::mutex > lock( mutex_ );
if( run_ )
{
handle = generate_handle();
handle = generate_handle();
event_creation_requests_.insert( event_creation_request( _time, _event, handle ) );
}
else
Expand Down
2 changes: 1 addition & 1 deletion libyasmine/source/transition_finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void transition_finder::search_choice_transitions( const raw_const_choices& _cho
if( !try_to_build_compound_transition( *transition, _compound_transitions, _event, _event_collector ) )
{
LOG_AND_THROW( hermes::log_level::LL_FATAL,
"Transition following choice '%' could not be built in compound transition!", choice->get_name() );
"Transition following choice '%' could not be built in compound transition!", choice->get_name() );
}
else
{
Expand Down
17 changes: 5 additions & 12 deletions libyasmine/source/vertex_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,14 @@ void vertex_impl::add_outgoing_transition( transition& _outgoing_transition )
{
if( has_no_guard( &_outgoing_transition ) )
{
outgoing_transitions_.push_back( &_outgoing_transition );
outgoing_transitions_.push_back( &_outgoing_transition );
}
else
{
raw_transitions::const_iterator insert_position = find_first_transition_without_guard( outgoing_transitions_ );
if( insert_position != outgoing_transitions_.end() )
raw_transitions::iterator insert_position = find_first_transition_without_guard( outgoing_transitions_ );
if( insert_position != outgoing_transitions_.end() )
{
#ifdef SX_CPP03_BOOST
raw_transitions::iterator insert_position_03 =
outgoing_transitions_.begin() +
std::distance( const_cast<const raw_transitions&>(outgoing_transitions_).begin(), insert_position );
outgoing_transitions_.insert( insert_position_03, &_outgoing_transition );
#else
outgoing_transitions_.insert( insert_position, &_outgoing_transition );
#endif
}
else
{
Expand Down Expand Up @@ -244,9 +237,9 @@ void vertex_impl::add_ancestor_uri( sxe::uri& _uri ) const
}


raw_transitions::const_iterator vertex_impl::find_first_transition_without_guard( const raw_transitions& _vector_of_transitions )
raw_transitions::iterator vertex_impl::find_first_transition_without_guard( raw_transitions& _vector_of_transitions )
{
raw_transitions::const_iterator found_position = std::find_if( _vector_of_transitions.begin(), _vector_of_transitions.end(),
raw_transitions::iterator found_position = std::find_if( _vector_of_transitions.begin(), _vector_of_transitions.end(),
( sxe::bind( &vertex_impl::has_no_guard, sxe::_1 ) ) );
return( found_position );
}
Expand Down

0 comments on commit c4ad90a

Please sign in to comment.