class ugcs::vsm::Action

Overview

Generic action. More…

#include <action.h>

class Action: public std::enable_shared_from_this< Action >
{
public:
    // typedefs

    typedef std::shared_ptr<Action> Ptr;
    typedef std::weak_ptr<Action> Weak_ptr;
    typedef ugcs::vsm::Param_exception<Format_exception_dummy_struct,> Format_exception;

    // enums

    enum Type;

    // structs

    struct Format_exception_dummy_struct;

    template <>
    struct Mapper<Action::Type::REPEAT_SERVO>;

    template <>
    struct Mapper<Action::Type::POI>;

    template <>
    struct Mapper<Action::Type::PAYLOAD_STEERING>;

    template <>
    struct Mapper<Action::Type::PANORAMA>;

    template <>
    struct Mapper<Action::Type::SET_HOME>;

    template <>
    struct Mapper<Action::Type::TAKEOFF>;

    template <>
    struct Mapper<Action::Type::SET_SERVO>;

    template <>
    struct Mapper<Action::Type::TASK_ATTRIBUTES>;

    template <>
    struct Mapper<Action::Type::VTOL_TRANSITION>;

    template <>
    struct Mapper<Action::Type::MOVE>;

    template <>
    struct Mapper<Action::Type::HEADING>;

    template <>
    struct Mapper<Action::Type::CAMERA_CONTROL>;

    template <Type type_val>
    struct Mapper;

    template <>
    struct Mapper<Action::Type::LANDING>;

    template <>
    struct Mapper<Action::Type::CAMERA_SERIES_BY_DISTANCE>;

    template <>
    struct Mapper<Action::Type::CAMERA_TRIGGER>;

    template <>
    struct Mapper<Action::Type::CAMERA_SERIES_BY_TIME>;

    template <>
    struct Mapper<Action::Type::CHANGE_SPEED>;

    template <>
    struct Mapper<Action::Type::WAIT>;

    // fields

    int command_id = -1;

    // construction

    Action(Type type);

    // methods

    template <typename... Args>
    static Ptr Create(Args&&... args);

    Type Get_type() const;
    void Set_id(int id);
    std::string Get_name();

    template <Type type_val>
    Mapper<type_val>::type::Ptr Get_action();
};

// direct descendants

class Camera_control_action;
class Camera_series_by_distance_action;
class Camera_series_by_time_action;
class Camera_trigger_action;
class Change_speed_action;
class Heading_action;
class Landing_action;
class Move_action;
class Panorama_action;
class Payload_steering_action;
class Poi_action;
class Repeat_servo_action;
class Set_home_action;
class Set_servo_action;
class Takeoff_action;
class Task_attributes_action;
class Vtol_transition_action;
class Wait_action;

Detailed Documentation

Generic action.

Specific actions are determined by Get_type method.

Typedefs

typedef std::shared_ptr<Action> Ptr

Pointer type.

typedef std::weak_ptr<Action> Weak_ptr

Pointer type.

Construction

Action(Type type)

Construct action of specific type.

Methods

template <typename... Args>
static Ptr Create(Args&&... args)

Create an instance.

Type Get_type() const

Get action type.

std::string Get_name()

Get human readable name of the action.

template <Type type_val>
Mapper<type_val>::type::Ptr Get_action()

Get pointer to specific action as determined by Get_type.

Returns:

Non-null shared pointer to specific action if type value given in template parameter is equal with the type returned by Get_type, otherwise empty shared pointer is returned.