1 |
10 |
wfjm |
// $Id: RlinkCommandExpect.hpp 375 2011-04-02 07:56:47Z mueller $
|
2 |
|
|
//
|
3 |
|
|
// Copyright 2011- 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 |
|
|
// 2011-03-12 368 1.0 Initial version
|
17 |
|
|
// 2011-01-15 355 0.1 First draft
|
18 |
|
|
// ---------------------------------------------------------------------------
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
/*!
|
22 |
|
|
\file
|
23 |
|
|
\version $Id: RlinkCommandExpect.hpp 375 2011-04-02 07:56:47Z mueller $
|
24 |
|
|
\brief Declaration of class RlinkCommandExpect.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
#ifndef included_Retro_RlinkCommandExpect
|
28 |
|
|
#define included_Retro_RlinkCommandExpect 1
|
29 |
|
|
|
30 |
|
|
#include <cstdint>
|
31 |
|
|
#include <vector>
|
32 |
|
|
|
33 |
|
|
namespace Retro {
|
34 |
|
|
|
35 |
|
|
class RlinkCommandExpect {
|
36 |
|
|
public:
|
37 |
|
|
|
38 |
|
|
RlinkCommandExpect();
|
39 |
|
|
explicit RlinkCommandExpect(uint8_t stat, uint8_t statmsk=0);
|
40 |
|
|
RlinkCommandExpect(uint8_t stat, uint8_t statmsk,
|
41 |
|
|
uint16_t data, uint16_t datamsk=0);
|
42 |
|
|
RlinkCommandExpect(uint8_t stat, uint8_t statmsk,
|
43 |
|
|
const std::vector<uint16_t>& block);
|
44 |
|
|
RlinkCommandExpect(uint8_t stat, uint8_t statmsk,
|
45 |
|
|
const std::vector<uint16_t>& block,
|
46 |
|
|
const std::vector<uint16_t>& blockmsk);
|
47 |
|
|
~RlinkCommandExpect();
|
48 |
|
|
|
49 |
|
|
void SetStatus(uint8_t stat, uint8_t statmsk=0);
|
50 |
|
|
void SetData(uint16_t data, uint16_t datamsk=0);
|
51 |
|
|
void SetBlock(const std::vector<uint16_t>& block);
|
52 |
|
|
void SetBlock(const std::vector<uint16_t>& block,
|
53 |
|
|
const std::vector<uint16_t>& blockmsk);
|
54 |
|
|
|
55 |
|
|
uint8_t StatusValue() const;
|
56 |
|
|
uint8_t StatusMask() const;
|
57 |
|
|
uint16_t DataValue() const;
|
58 |
|
|
uint16_t DataMask() const;
|
59 |
|
|
const std::vector<uint16_t>& BlockValue() const;
|
60 |
|
|
const std::vector<uint16_t>& BlockMask() const;
|
61 |
|
|
|
62 |
|
|
bool StatusCheck(uint8_t val) const;
|
63 |
|
|
bool DataCheck(uint16_t val) const;
|
64 |
|
|
bool BlockCheck(size_t ind, uint16_t val) const;
|
65 |
|
|
size_t BlockCheck(const uint16_t* pval, size_t size) const;
|
66 |
|
|
|
67 |
|
|
bool StatusIsChecked() const;
|
68 |
|
|
bool DataIsChecked() const;
|
69 |
|
|
bool BlockIsChecked(size_t ind) const;
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
void Dump(std::ostream& os, int ind=0, const char* text=0) const;
|
73 |
|
|
|
74 |
|
|
protected:
|
75 |
|
|
uint8_t fStatusVal; //!< status value
|
76 |
|
|
uint8_t fStatusMsk; //!< status mask
|
77 |
|
|
uint16_t fDataVal; //!< data value
|
78 |
|
|
uint16_t fDataMsk; //!< data mask
|
79 |
|
|
std::vector<uint16_t> fBlockVal; //!< block value
|
80 |
|
|
std::vector<uint16_t> fBlockMsk; //!< block mask
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
} // end namespace Retro
|
84 |
|
|
|
85 |
|
|
#if !(defined(Retro_NoInline) || defined(Retro_RlinkCommandExpect_NoInline))
|
86 |
|
|
#include "RlinkCommandExpect.ipp"
|
87 |
|
|
#endif
|
88 |
|
|
|
89 |
|
|
#endif
|