-module(cb_player_sup).

-behaviour(supervisor).

%% API
-export([start_link/0,
        create_player/1]).

%% Supervisor callbacks
-export([init/1]).

-define(CHILD(Id, Mod, Type, Args), {Id, {Mod, start_link, Args},
                                     temporary, brutal_kill, Type, [Mod]}).

%%%===================================================================
%%% API functions
%%%===================================================================

%%--------------------------------------------------------------------
%% @doc
%% Starts the supervisor
%%
    ( ) - > { ok , Pid } | ignore | { error , Error }
%% @end
%%--------------------------------------------------------------------
start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

create_player(Sock) ->
    supervisor:start_child(?MODULE, [Sock]).

%%%===================================================================
%%% Supervisor callbacks
%%%===================================================================

%%--------------------------------------------------------------------
  @private
%% @doc
%% Whenever a supervisor is started using supervisor:start_link/[2,3],
%% this function is called by the new process to find out about
%% restart strategy, maximum restart frequency and child
%% specifications.
%%
    ) - > { ok , { SupFlags , [ ChildSpec ] } } |
%%                     ignore |
%%                     {error, Reason}
%% @end
%%--------------------------------------------------------------------
init([]) ->
    {ok, {{simple_one_for_one, 0, 1},
          [?CHILD(cb_player, cb_player, worker, [])]
         }}.

%%%===================================================================
  Internal functions
%%%===================================================================

 API
 Supervisor callbacks
===================================================================
 API functions
===================================================================
--------------------------------------------------------------------
 @doc
 Starts the supervisor

 @end
--------------------------------------------------------------------
===================================================================
 Supervisor callbacks
===================================================================
--------------------------------------------------------------------
 @doc
 Whenever a supervisor is started using supervisor:start_link/[2,3],
 this function is called by the new process to find out about
 restart strategy, maximum restart frequency and child
 specifications.

                     ignore |
                     {error, Reason}
 @end
--------------------------------------------------------------------
===================================================================
===================================================================
-module(cb_player_sup).

-behaviour(supervisor).

-export([start_link/0,
        create_player/1]).

-export([init/1]).

-define(CHILD(Id, Mod, Type, Args), {Id, {Mod, start_link, Args},
                                     temporary, brutal_kill, Type, [Mod]}).


    ( ) - > { ok , Pid } | ignore | { error , Error }
start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

create_player(Sock) ->
    supervisor:start_child(?MODULE, [Sock]).


  @private
    ) - > { ok , { SupFlags , [ ChildSpec ] } } |
init([]) ->
    {ok, {{simple_one_for_one, 0, 1},
          [?CHILD(cb_player, cb_player, worker, [])]
         }}.

  Internal functions
