Back to index

unity  6.0.0
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
unity::dash::Model< RowAdaptor > Class Template Reference

#include <Model.h>

Inheritance diagram for unity::dash::Model< RowAdaptor >:
Inheritance graph
[legend]
Collaboration diagram for unity::dash::Model< RowAdaptor >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::shared_ptr< ModelPtr

Public Member Functions

 Model ()
 Model (ModelType model_type)
virtual ~Model ()
const RowAdaptor RowAtIndex (std::size_t index)

Public Attributes

nux::Property< std::string > swarm_name
nux::ROProperty< std::size_t > count
nux::ROProperty< unsigned long
long > 
seqnum
nux::ROProperty< glib::Object
< DeeModel > > 
model
sigc::signal< void, RowAdaptor & > row_added
sigc::signal< void, RowAdaptor & > row_changed
sigc::signal< void, RowAdaptor & > row_removed
sigc::signal< void, unsigned
long long, unsigned long long > 
begin_transaction
sigc::signal< void, unsigned
long long, unsigned long long > 
end_transaction

Private Member Functions

void Init ()
void OnRowAdded (DeeModel *model, DeeModelIter *iter)
void OnRowChanged (DeeModel *model, DeeModelIter *iter)
void OnRowRemoved (DeeModel *model, DeeModelIter *iter)
void OnTransactionBegin (DeeModel *model, guint64 begin_seq, guint64 end_seq)
void OnTransactionEnd (DeeModel *model, guint64 begin_seq, guint64 end_seq)
void OnSwarmNameChanged (std::string const &swarm_name)
std::size_t get_count ()
unsigned long long get_seqnum ()
glib::Object< DeeModel > get_model ()

Private Attributes

glib::Object< DeeModel > model_
glib::SignalManager sig_manager_
DeeModelTag * renderer_tag_
ModelType model_type_

Detailed Description

template<class RowAdaptor>
class unity::dash::Model< RowAdaptor >

Definition at line 50 of file Model.h.


Member Typedef Documentation

template<class RowAdaptor>
typedef std::shared_ptr<Model> unity::dash::Model< RowAdaptor >::Ptr

Reimplemented in unity::dash::Filters, unity::dash::Categories, and unity::dash::Results.

Definition at line 53 of file Model.h.


Constructor & Destructor Documentation

template<class RowAdaptor >
unity::dash::Model< RowAdaptor >::Model ( )

Definition at line 36 of file Model-inl.h.

Here is the call graph for this function:

template<class RowAdaptor >
unity::dash::Model< RowAdaptor >::Model ( ModelType  model_type)

Definition at line 43 of file Model-inl.h.

  : model_type_(model_type)
{
  Init();

  if (model_type == ModelType::LOCAL)
    swarm_name = ":local";
}

Here is the call graph for this function:

template<class RowAdaptor >
unity::dash::Model< RowAdaptor >::~Model ( ) [virtual]

Definition at line 112 of file Model-inl.h.

{}

Member Function Documentation

template<class RowAdaptor >
std::size_t unity::dash::Model< RowAdaptor >::get_count ( ) [private]

Definition at line 166 of file Model-inl.h.

{
  if (model_)
    return dee_model_get_n_rows(model_);
  else
    return 0;
}
template<class RowAdaptor >
glib::Object< DeeModel > unity::dash::Model< RowAdaptor >::get_model ( ) [private]

Definition at line 184 of file Model-inl.h.

{
  return model_;
}
template<class RowAdaptor >
unsigned long long unity::dash::Model< RowAdaptor >::get_seqnum ( ) [private]

Definition at line 175 of file Model-inl.h.

{
  if (model_ && DEE_IS_SERIALIZABLE_MODEL ((DeeModel*) model_))
    return dee_serializable_model_get_seqnum(model_);
  else
    return 0;
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::Init ( ) [private]

Definition at line 53 of file Model-inl.h.

{
  swarm_name.changed.connect(sigc::mem_fun(this, &Model<RowAdaptor>::OnSwarmNameChanged));
  count.SetGetterFunction(sigc::mem_fun(this, &Model<RowAdaptor>::get_count));
  seqnum.SetGetterFunction(sigc::mem_fun(this, &Model<RowAdaptor>::get_seqnum));
  model.SetGetterFunction(sigc::mem_fun(this, &Model<RowAdaptor>::get_model));
}

Here is the caller graph for this function:

template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnRowAdded ( DeeModel< RowAdaptor > *  model,
DeeModelIter *  iter 
) [private]

Definition at line 116 of file Model-inl.h.

{
  RowAdaptor it(model, iter, renderer_tag_);
  row_added.emit(it);
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnRowChanged ( DeeModel< RowAdaptor > *  model,
DeeModelIter *  iter 
) [private]

Definition at line 123 of file Model-inl.h.

{
  RowAdaptor it(model, iter, renderer_tag_);
  row_changed.emit(it);
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnRowRemoved ( DeeModel< RowAdaptor > *  model,
DeeModelIter *  iter 
) [private]

Definition at line 130 of file Model-inl.h.

{
  RowAdaptor it(model, iter, renderer_tag_);
  row_removed.emit(it);
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnSwarmNameChanged ( std::string const &  swarm_name) [private]

Definition at line 62 of file Model-inl.h.

{
  typedef glib::Signal<void, DeeModel*, DeeModelIter*> RowSignalType;
  typedef glib::Signal<void, DeeModel*, guint64, guint64> TransactionSignalType;

  LOG_DEBUG(_model_inl_logger) << "New swarm name: " << swarm_name;

  // Let the views clean up properly
  if (model_)
    dee_model_clear(model_);

  switch(model_type_)
  {
    case ModelType::LOCAL:
      model_ = dee_sequence_model_new();
      break;
    case ModelType::REMOTE:
      model_ = dee_shared_model_new(swarm_name.c_str());
      sig_manager_.Add(new TransactionSignalType(model_,
                                                 "begin-transaction",
                                                 sigc::mem_fun(this, &Model<RowAdaptor>::OnTransactionBegin)));

      sig_manager_.Add(new TransactionSignalType(model_,
                                                 "end-transaction",
                                                 sigc::mem_fun(this, &Model<RowAdaptor>::OnTransactionEnd)));
      break;
    default:
      LOG_ERROR(_model_inl_logger) <<  "Unexpected ModelType " << model_type_;
      break;
  }

  model.EmitChanged(model_);


  renderer_tag_ = dee_model_register_tag(model_, NULL);

  sig_manager_.Add(new RowSignalType(model_,
                                     "row-added",
                                     sigc::mem_fun(this, &Model<RowAdaptor>::OnRowAdded)));

  sig_manager_.Add(new RowSignalType(model_,
                                     "row-changed",
                                     sigc::mem_fun(this, &Model<RowAdaptor>::OnRowChanged)));

  sig_manager_.Add(new RowSignalType(model_,
                                     "row-removed",
                                     sigc::mem_fun(this, &Model<RowAdaptor>::OnRowRemoved)));
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnTransactionBegin ( DeeModel< RowAdaptor > *  model,
guint64  begin_seq,
guint64  end_seq 
) [private]

Definition at line 137 of file Model-inl.h.

{
  unsigned long long begin_seqnum, end_seqnum;

  begin_seqnum = static_cast<unsigned long long> (begin_seqnum64);
  end_seqnum = static_cast<unsigned long long> (end_seqnum64);
  begin_transaction.emit(begin_seqnum, end_seqnum);
}
template<class RowAdaptor >
void unity::dash::Model< RowAdaptor >::OnTransactionEnd ( DeeModel< RowAdaptor > *  model,
guint64  begin_seq,
guint64  end_seq 
) [private]

Definition at line 147 of file Model-inl.h.

{
  unsigned long long begin_seqnum, end_seqnum;

  begin_seqnum = static_cast<unsigned long long> (begin_seqnum64);
  end_seqnum = static_cast<unsigned long long> (end_seqnum64);
  end_transaction.emit(begin_seqnum, end_seqnum);
}
template<class RowAdaptor >
const RowAdaptor unity::dash::Model< RowAdaptor >::RowAtIndex ( std::size_t  index)

Definition at line 157 of file Model-inl.h.

{
  RowAdaptor it(model_,
                dee_model_get_iter_at_row(model_, index),
                renderer_tag_);
  return it;
}

Member Data Documentation

template<class RowAdaptor>
sigc::signal<void, unsigned long long, unsigned long long> unity::dash::Model< RowAdaptor >::begin_transaction

Definition at line 70 of file Model.h.

template<class RowAdaptor>
nux::ROProperty<std::size_t> unity::dash::Model< RowAdaptor >::count

Definition at line 62 of file Model.h.

template<class RowAdaptor>
sigc::signal<void, unsigned long long, unsigned long long> unity::dash::Model< RowAdaptor >::end_transaction

Definition at line 71 of file Model.h.

template<class RowAdaptor>
nux::ROProperty<glib::Object<DeeModel> > unity::dash::Model< RowAdaptor >::model

Definition at line 64 of file Model.h.

template<class RowAdaptor>
glib::Object<DeeModel> unity::dash::Model< RowAdaptor >::model_ [private]

Definition at line 86 of file Model.h.

template<class RowAdaptor>
ModelType unity::dash::Model< RowAdaptor >::model_type_ [private]

Definition at line 89 of file Model.h.

template<class RowAdaptor>
DeeModelTag* unity::dash::Model< RowAdaptor >::renderer_tag_ [private]

Definition at line 88 of file Model.h.

template<class RowAdaptor>
sigc::signal<void, RowAdaptor&> unity::dash::Model< RowAdaptor >::row_added

Definition at line 66 of file Model.h.

template<class RowAdaptor>
sigc::signal<void, RowAdaptor&> unity::dash::Model< RowAdaptor >::row_changed

Definition at line 67 of file Model.h.

template<class RowAdaptor>
sigc::signal<void, RowAdaptor&> unity::dash::Model< RowAdaptor >::row_removed

Definition at line 68 of file Model.h.

template<class RowAdaptor>
nux::ROProperty<unsigned long long> unity::dash::Model< RowAdaptor >::seqnum

Definition at line 63 of file Model.h.

template<class RowAdaptor>
glib::SignalManager unity::dash::Model< RowAdaptor >::sig_manager_ [private]

Definition at line 87 of file Model.h.

template<class RowAdaptor>
nux::Property<std::string> unity::dash::Model< RowAdaptor >::swarm_name

Definition at line 61 of file Model.h.


The documentation for this class was generated from the following files: