OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librwxxtpp/] [RtclRw11Cntl.cpp] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: RtclRw11Cntl.cpp 504 2013-04-13 15:37:24Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-03-06   495   1.0    Initial version
17
// 2013-02-08   484   0.1    First draft
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: RtclRw11Cntl.cpp 504 2013-04-13 15:37:24Z mueller $
23
  \brief   Implemenation of RtclRw11Cntl.
24
*/
25
 
26
#include "boost/thread/locks.hpp"
27
#include "boost/bind.hpp"
28
 
29
#include "librtcltools/RtclStats.hpp"
30
 
31
#include "RtclRw11Cntl.hpp"
32
 
33
using namespace std;
34
 
35
/*!
36
  \class Retro::RtclRw11Cntl
37
  \brief FIXME_docs
38
*/
39
 
40
// all method definitions in namespace Retro
41
namespace Retro {
42
 
43
//------------------------------------------+-----------------------------------
44
//! Constructor
45
 
46
RtclRw11Cntl::RtclRw11Cntl(const std::string& type)
47
  : RtclProxyBase(type),
48
    fGets(),
49
    fSets()
50
{
51
  AddMeth("get",      boost::bind(&RtclRw11Cntl::M_get,     this, _1));
52
  AddMeth("set",      boost::bind(&RtclRw11Cntl::M_set,     this, _1));
53
  AddMeth("probe",    boost::bind(&RtclRw11Cntl::M_probe,   this, _1));
54
  AddMeth("stats",    boost::bind(&RtclRw11Cntl::M_stats,   this, _1));
55
  AddMeth("dump",     boost::bind(&RtclRw11Cntl::M_dump,    this, _1));
56
  AddMeth("$default", boost::bind(&RtclRw11Cntl::M_default, this, _1));
57
}
58
 
59
//------------------------------------------+-----------------------------------
60
//! Destructor
61
 
62
RtclRw11Cntl::~RtclRw11Cntl()
63
{}
64
 
65
//------------------------------------------+-----------------------------------
66
//! FIXME_docs
67
 
68
int RtclRw11Cntl::M_get(RtclArgs& args)
69
{
70
  // synchronize with server thread
71
  boost::lock_guard<RlinkConnect> lock(Obj().Connect());
72
  return fGets.M_get(args);
73
}
74
 
75
//------------------------------------------+-----------------------------------
76
//! FIXME_docs
77
 
78
int RtclRw11Cntl::M_set(RtclArgs& args)
79
{
80
  // synchronize with server thread
81
  boost::lock_guard<RlinkConnect> lock(Obj().Connect());
82
  return fSets.M_set(args);
83
}
84
 
85
//------------------------------------------+-----------------------------------
86
//! FIXME_docs
87
 
88
int RtclRw11Cntl::M_probe(RtclArgs& args)
89
{
90
  if (!args.AllDone()) return kERR;
91
  args.SetResult(Obj().Probe());
92
  return kOK;
93
}
94
 
95
//------------------------------------------+-----------------------------------
96
//! FIXME_docs
97
 
98
int RtclRw11Cntl::M_stats(RtclArgs& args)
99
{
100
  RtclStats::Context cntx;
101
  if (!RtclStats::GetArgs(args, cntx)) return kERR;
102
  if (!RtclStats::Collect(args, cntx, Obj().Stats())) return kERR;
103
  return kOK;
104
}
105
 
106
//------------------------------------------+-----------------------------------
107
//! FIXME_docs
108
 
109
int RtclRw11Cntl::M_dump(RtclArgs& args)
110
{
111
  if (!args.AllDone()) return kERR;
112
 
113
  ostringstream sos;
114
  Obj().Dump(sos, 0);
115
  args.SetResult(sos);
116
  return kOK;
117
}
118
 
119
//------------------------------------------+-----------------------------------
120
//! FIXME_docs
121
 
122
int RtclRw11Cntl::M_default(RtclArgs& args)
123
{
124
  if (!args.AllDone()) return kERR;
125
  ostringstream sos;
126
  sos << "no default output defined yet...\n";
127
  args.AppendResultLines(sos);
128
  return kOK;
129
}
130
 
131
} // end namespace Retro

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.