Changeset 10657


Ignore:
Timestamp:
05/11/11 10:27:33 (14 years ago)
Author:
tbretz
Message:
Added or improved documentation.
Location:
trunk/FACT++
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/CheckBoxDelegate.cc

    r10394 r10657  
     1// **************************************************************************
     2/** @class CheckBoxDelegate
     3
     4@brief A delegate which displays an arrow if there are sub items and raises an event if the checkbox is checked
     5
     6*/
     7// **************************************************************************
    18#include "CheckBoxDelegate.h"
    29
    3 #include <QtGui/QPainter>
    4 #include <QtGui/QApplication>
     10#include <QPainter>
     11#include <QApplication>
    512
    613void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
     
    6976    return rc;
    7077}
     78
     79// **************************************************************************
     80/** @class CheckBoxEvent
     81
     82@brief An event posted by the CheckBoxDelegate if the CheckBox is used
     83
     84*/
     85// **************************************************************************
  • trunk/FACT++/gui/CheckBoxDelegate.h

    r10394 r10657  
    22#define FACT_CheckBoxDelegate
    33
    4 #include <QtCore/QEvent>
    5 #include <QtGui/QStandardItem>
     4#include <QEvent>
     5#include <QStandardItem>
    66
    77using namespace std;
     
    1818
    1919
    20 #include <QtGui/QStyledItemDelegate>
     20#include <QStyledItemDelegate>
    2121
    2222class CheckBoxDelegate : public QStyledItemDelegate
    2323{
    24     Q_OBJECT;
    25 
    2624public:
    2725    CheckBoxDelegate(QObject *p=0) : QStyledItemDelegate(p)
  • trunk/FACT++/gui/DockWindow.cc

    r10466 r10657  
     1// **************************************************************************
     2/** @class DockWindow
     3
     4@brief A main window which can be used to display a QDockWidget from a tab
     5
     6*/
     7// **************************************************************************
    18#include "DockWindow.h"
    29
     
    714
    815using namespace std;
    9 
    10 #include <iostream>
    1116
    1217DockWindow::DockWindow(QDockWidget *d, const QString &name)
     
    4247    QWidget *w = new QWidget;
    4348
    44     QGridLayout *l =  new QGridLayout(w);
     49    QGridLayout *l = new QGridLayout(w);
    4550    //layout->setObjectName(QString::fromUtf8("gridLayout_")+windowTitle());
    4651    l->addWidget(fDockWidget, 0, 0, 1, 1);
     
    5055
    5156    fDockWidget->setParent(w);
    52 
    5357}
  • trunk/FACT++/gui/HtmlDelegate.cc

    r10475 r10657  
     1// **************************************************************************
     2/** @class HtmlDelegate
     3
     4@brief A Qt-Delegate to display HTML text (QTextDocument) in a list
     5
     6*/
     7// **************************************************************************
    18#include "HtmlDelegate.h"
    29
    3 #include <QtGui/QPainter>
    4 #include <QtGui/QTextDocument>
     10#include <QPainter>
     11#include <QTextDocument>
    512
    613void HtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
  • trunk/FACT++/gui/HtmlDelegate.h

    r10394 r10657  
    22#define FACT_HtmlDelegate
    33
    4 #include <QtGui/QStyledItemDelegate>
    5 
    6 using namespace std;
     4#include <QStyledItemDelegate>
    75
    86class HtmlDelegate : public QStyledItemDelegate
    97{
    10     Q_OBJECT;
    11 
    128public:
    139    HtmlDelegate(QObject *p=0) : QStyledItemDelegate(p)
  • trunk/FACT++/gui/MainWindow.cc

    r10644 r10657  
    3131    fDimSvcDescription->setItemDelegate(new HtmlDelegate);
    3232
     33    // Set a default string to be displayed in a the status bar at startup
    3334    fStatusBar->showMessage(PACKAGE_STRING"   |   "PACKAGE_URL"   |   report bugs to <"PACKAGE_BUGREPORT">");
    3435
     36    // Initialize the 40 FTU Leds as a copy of the prototype LED
    3537    fFtuLED[0] = fFtuLEDPrototype;
    3638
     
    5860    }
    5961
     62    // Initialize a timer to update the displayed UTC time
    6063    QTimer *timer = new QTimer(this);
    6164    connect(timer, SIGNAL(timeout()), this, SLOT(slot_TimeUpdate()));
  • trunk/FACT++/gui/SpinBoxHex.h

    r10605 r10657  
    22#define FACT_SpinBoxHex
    33
    4 #include <QtGui/QSpinBox>
     4#include <QSpinBox>
    55
    66
     
    3737#endif
    3838
     39// **************************************************************************
     40/** @class SpinBoxHex
     41
     42@brief A QSpinBox which displays the value as hex-value
     43
     44*/
     45// **************************************************************************
  • trunk/FACT++/src/Converter.cc

    r10467 r10657  
    895895       for (int j=0; j<n; j++)
    896896       {
    897  //ETIENNE moved the +s-1 to the second argument and removed the -1
    898897           reverse_copy(charSrc,  charSrc+s, charDest);
    899                
     898
    900899           charSrc  += s;
    901900           charDest += s;
     
    933932    return Print(cout);
    934933}
    935 
    936 
    937 
    938 
    939 
    940 
    941 
  • trunk/FACT++/src/Converter.h

    r10640 r10657  
    1313
    1414#include <iostream>
     15
    1516class Converter
    1617{
     
    114115        for (size_t i=0; i<size/sizeof(T); i++)
    115116        {
    116             if (prefix && i%col==0)
     117            if (prefix && col!=0 && i%col==0)
    117118                text << std::setfill('0') << std::setw(w) << i << "| ";
    118119
     
    143144
    144145// ***************************************************************************
    145 /** @fn GetHex(const void *dat, size_t size)
     146/** @fn GetHex(const void *dat, size_t size, size_t col, bool prefix)
    146147
    147148Converts from a binary block into a hex representation.
     
    154155
    155156@param col
    156     Number of columns before new line
     157    Number of columns before new line (zero <default> to write a
     158    continous stream
     159
     160@param prefix
     161    Boolean which defines whether each line should be prefixed with a counter,
     162    the default is true. It is ignored if col==0
    157163
    158164@tparam T
     
    163169    The string
    164170
    165 
    166171**/
    167172// ***************************************************************************
  • trunk/FACT++/src/Dim.cc

    r10645 r10657  
     1// **************************************************************************
     2/** @namespace Dim
     3
     4@brief Namespace to host some global Dim helper functions
     5
     6*/
     7// **************************************************************************
    18#include "Dim.h"
    29
     
    1017using namespace std;
    1118
    12 string Dim::GetLocalIp()
     19// --------------------------------------------------------------------------
     20//
     21//! Tries to determine the local IP address with which we will connect
     22//! to the DIM dns.
     23//!
     24//! @param dns
     25//!     Address of the Dim-dns
     26//!
     27//! @returns
     28//!     The IP Address through which the connection to the DNS will
     29//!     take place.
     30//!
     31string Dim::GetLocalIp(const string &dns)
    1332{
    14     const char *kDnsIp = getenv("DIM_DNS_NODE");
    15 
    1633    struct addrinfo hints, *servinfo, *p;
    1734
     
    2138
    2239    int rv;
    23     if ((rv = getaddrinfo(kDnsIp, NULL, &hints, &servinfo)) != 0)
     40    if ((rv = getaddrinfo(dns.c_str(), NULL, &hints, &servinfo)) != 0)
    2441    {
    2542        cout << "WARNING - getaddrinfo: " << gai_strerror(rv) << endl;
    26         return kDnsIp;
     43        return dns;
    2744    }
    2845
     
    6885    freeaddrinfo(servinfo); // all done with this structure
    6986
    70     return kDnsIp;
     87    return dns;
    7188}
    7289
     90// --------------------------------------------------------------------------
     91//
     92//! Set the environment variable DIM_DNS_NODE to the given string and
     93//! DIM_HOST_NODE to the IP-address through which this machine connects
     94//! to the dns.
     95//!
     96//! @param dns
     97//!     Address of the Dim-dns
     98//!
    7399void Dim::Setup(const std::string &dns)
    74100{
    75     setenv("DIM_DNS_NODE",  dns.c_str(),          1);
    76     setenv("DIM_HOST_NODE", GetLocalIp().c_str(), 1);
     101    setenv("DIM_DNS_NODE",  dns.c_str(),             1);
     102    setenv("DIM_HOST_NODE", GetLocalIp(dns).c_str(), 1);
    77103}
  • trunk/FACT++/src/Dim.h

    r10645 r10657  
    88namespace Dim
    99{
     10    std::string GetLocalIp(const std::string &dns);
     11    void Setup(const std::string &dns);
     12
     13    // --------------------------------------------------------------------------
     14    //
     15    //! Simplification wrapper to send a command without data
     16    //!
     17    //! Example:
     18    //!   - Dim::SendCommand("SERVER/COMMAND");
     19    //!
     20    //! @param command
     21    //!     Dim command identifier
     22    //!
     23    //! @returns
     24    //!     the return value of DimClient::sendCommand
     25    //!
    1026    inline bool SendCommand(const std::string &command)
    1127    {
     
    1329    }
    1430
     31    // --------------------------------------------------------------------------
     32    //
     33    //! Simplification wrapper to send a command with the given data
     34    //!
     35    //! Example:
     36    //!   - Dim::SendCommand("SERVER/COMMAND", uint16_t(42));
     37    //!   - struct tm t; Dim::SendCommand("SERVER/TIME", t);
     38    //!
     39    //! @param command
     40    //!     Dim command identifier
     41    //!
     42    //! @param t
     43    //!     object to be sent, the pointer to the data to be sent is
     44    //!     set to &t
     45    //!
     46    //! @template T
     47    //!     type of the data to be sent. The size of the data to be sent
     48    //!     is determined as sizeof(T)
     49    //!
     50    //! @returns
     51    //!     the return value of DimClient::sendCommand
     52    //!
    1553    template<typename T>
    1654        inline bool SendCommand(const std::string &command, const T &t)
     
    1856        return DimClient::sendCommand(command.c_str(), (void*)&t, sizeof(t));
    1957    }
    20 
    21     std::string GetLocalIp();
    22 
    23     void Setup(const std::string &dns);
    2458}
    2559
  • trunk/FACT++/src/DimDescriptionService.cc

    r10477 r10657  
    2525The description should contain as many descriptions as format chunks, e.g.
    2626
    27 I:1          should contain one description chunks
    28 I:1;F:1      should contain two description chunks
    29 I:2;F:1      should contain two description chunks
    30 I:2;I:1;F:1  should contain three description chunks
     27 - I:1          should contain one description chunks
     28 - I:1;F:1      should contain two description chunks
     29 - I:2;F:1      should contain two description chunks
     30 - I:2;I:1;F:1  should contain three description chunks
    3131
    3232*/
  • trunk/FACT++/src/DimErrorRedirecter.cc

    r10583 r10657  
    11// **************************************************************************
    22/** @class DimErrorRedirecter
     3
     4@brief A base class taking care of padding, exit handler and error handlers
     5
     6This class first switches off padding for the DimServer and the DimClient
     7(dis and dic). Furthermore, it redirects both error handlers to the
     8DimErrorRedirecter. Redirect the exit handler.
     9
     10Only one instance of this class is allowed, since all Dim handlers are
     11global.
     12
     13In the destructor of the class the handlers are correctly restored.
     14The padding setup is kept.
     15
     16For FACT++ all Dim data is transmitted without padding!
     17
     18To catch the error messages overwrite the errorHandler. The errorHandler
     19of the DimErrorRedirecter redirects the error messages to the logging
     20stream given in the constructor.
     21
     22To catch the exit requests overwrite the exitHandler.
    323
    424*/
     
    1535int DimErrorRedirecter::cnt = 0;
    1636
     37// --------------------------------------------------------------------------
     38//
     39//! - disable padding for dim server and dim client
     40//! - redirect DimClient error handler
     41//! - redirect DimServer error handler
     42//! - set exit handler of DimServer
     43//
    1744DimErrorRedirecter::DimErrorRedirecter(MessageImp &imp) : fMsg(imp)
    1845{
     
    3158}
    3259
     60// --------------------------------------------------------------------------
     61//
     62//! - reset DimClient error handler
     63//! - reset DimServer error handler
     64//! - reset exit handler of DimServer
     65//
    3366DimErrorRedirecter::~DimErrorRedirecter()
    3467{
  • trunk/FACT++/src/DimServerList.cc

    r10570 r10657  
    122122// --------------------------------------------------------------------------
    123123//
     124//! @param server
     125//!     server-name to check for
     126//!
     127//! @returns
     128//!     whether the server with the given name is online or not
     129//!
    124130bool DimServerList::HasServer(const std::string &server) const
    125131{
  • trunk/FACT++/src/EventImp.cc

    r10486 r10657  
    208208//! @param out
    209209//!    An ostream to which the output should be redirected.
     210//!
     211//! @param strip
     212//!    defines whether a possible SERVER name in the event name
     213//!    should be stripped or not.
    210214//!
    211215void EventImp::Print(ostream &out, bool strip) const
     
    277281//
    278282//! Calls Print(std::cout)
     283//!
     284//! @param strip
     285//!    defines whether a possible SERVER name in the event name
     286//!    should be stripped or not.
    279287//
    280288void EventImp::Print(bool strip) const
  • trunk/FACT++/src/FACT.cc

    r10652 r10657  
     1// **************************************************************************
     2/** @namespace FACT
     3
     4@brief Namespace to help with some general things in the program initialization
     5
     6*/
     7// **************************************************************************
    18#include "FACT.h"
    29
     
    512#include <boost/filesystem.hpp>
    613
    7 /*
    8  The first line of the --version information is assumed to be in one
    9  of the following formats:
    10 
    11    <version>
    12    <program> <version>
    13    {GNU,Free} <program> <version>
    14    <program> ({GNU,Free} <package>) <version>
    15    <program> - {GNU,Free} <package> <version>
    16 
    17  and separated from any copyright/author details by a blank line.
    18 
    19  Handle multi-line bug reporting sections of the form:
    20 
    21    Report <program> bugs to <addr>
    22    GNU <package> home page: <url>
    23    ...
    24 */
     14// --------------------------------------------------------------------------
     15//
     16//! Print version information about FACT++
     17//!
     18//! From help2man:
     19//!
     20//! The first line of the --version information is assumed to be in one
     21//! of the following formats:
     22//!
     23//!  - <version>
     24//!  - <program> <version>
     25//!  - {GNU,Free} <program> <version>
     26//!  - <program> ({GNU,Free} <package>) <version>
     27//!  - <program> - {GNU,Free} <package> <version>
     28//!
     29//!  and separated from any copyright/author details by a blank line.
     30//!
     31//! Handle multi-line bug reporting sections of the form:
     32//!
     33//!  - Report <program> bugs to <addr>
     34//!  - GNU <package> home page: <url>
     35//!  - ...
     36//!
     37//!
     38//! @param name
     39//!     name of the program (usually argv[0]). A possible leading "lt-"
     40//!     is removed.
     41//!
    2542void FACT::PrintVersion(const char *name)
    2643{
  • trunk/FACT++/src/StateMachineImp.cc

    r10586 r10657  
    295295//!    size of the memory which should be attached to the event
    296296//!
     297//! @returns
     298//!    false if the event is ignored, true otherwise.
     299//!
    297300//! @todo
    298301//!    - Shell we check for the validity of a command at the current state, too?
     
    333336//!    event should be for.
    334337//!
     338//! @returns
     339//!    false if the event is ignored, true otherwise.
     340//!
    335341//! @todo
    336342//!    - Shell we check for the validity of a command at the current state, too?
     
    357363}
    358364
     365// --------------------------------------------------------------------------
     366//
     367//! Return all event names of the StateMachine
     368//!
     369//! @returns
     370//!    A vector of strings with all event names of the state machine.
     371//!    The event names all have the SERVER/ pre-fix removed.
     372//
    359373const vector<string> StateMachineImp::GetEventNames() const
    360374{
     
    10101024//!    if functions are assigned directly to any event to simulate
    10111025//!    a running loop (e.g. block until Stop() was called or fExitRequested
    1012 //!    was set by an EXIT command.
     1026//!    was set by an EXIT command.  If dummy==true, fRunning is not set
     1027//!    to true to allow handling events directly from the event handler.
    10131028//!
    10141029//! @returns
Note: See TracChangeset for help on using the changeset viewer.