JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Tweet
UserInterface.H
Go to the documentation of this file.
1
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
//
3
// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4
// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5
//
6
// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7
// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8
// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10
// License for more details. You should have received a copy of the GNU General Public License along with this program;
11
// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12
//
13
// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14
// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16
/*! \file */
17
18
#pragma once
19
20
#include <
jevois/Component/Component.H
>
21
22
namespace
jevois
23
{
24
//! Abstract base class for a string-based user interface
25
/*! Users interact with the JeVois hardware by issuing text commands and receiving text answers. UserInterface is an
26
abstract base class for such communications, with derived classes Serial (on the platform hardware, using hardware
27
serial and serial-over-usb) or StdioInterface (on host, using user inputs and outputs in the terminal).
28
29
See \ref UserCli for the user documentation of the command-line interface.
30
31
\ingroup core */
32
class
UserInterface
:
public
Component
33
{
34
public
:
35
//! Constructor
36
UserInterface
(std::string
const
& instance);
37
38
//! Destructor
39
virtual
~UserInterface
();
40
41
//! Read some bytes if available, and return true and a string when one is complete (RETURN pressed)
42
/*! str is untouched if user input is not yet complete (RETURN not yet pressed). The RETURN (end of line) marker
43
is not copied into str, only the characters received up to the end of line marker. */
44
virtual
bool
readSome
(std::string & str) = 0;
45
46
//! Write a string
47
/*! No line terminator should be included in the string, writeString() will add one. In the Serial derived class,
48
this will be using the line termination convention of serial::linestyle to support different styles (CR, CRLF,
49
LF, etc). */
50
virtual
void
writeString
(std::string
const
& str) = 0;
51
52
//! Write a string, with a prefix prepended
53
/*! No line terminator should be included in the string, writeString() will add one. In the Serial derived class,
54
this will be using the line termination convention of serial::linestyle to support different styles (CR, CRLF,
55
LF, etc). */
56
virtual
void
writeString
(std::string
const
& prefix, std::string
const
& str);
57
58
//! Enum for the interface type
59
enum class
Type
{
Hard
,
USB
,
Stdio
,
GUI
};
60
61
//! Derived classes must implement this and return their interface type
62
virtual
Type
type
()
const
= 0;
63
};
64
}
// namespace jevois
jevois::UserInterface::readSome
virtual bool readSome(std::string &str)=0
Read some bytes if available, and return true and a string when one is complete (RETURN pressed)
jevois::UserInterface::Type::Hard
@ Hard
jevois::UserInterface::~UserInterface
virtual ~UserInterface()
Destructor.
Definition:
UserInterface.C:26
jevois::UserInterface
Abstract base class for a string-based user interface.
Definition:
UserInterface.H:32
jevois::Component
A component of a model hierarchy.
Definition:
Component.H:181
jevois::UserInterface::writeString
virtual void writeString(std::string const &str)=0
Write a string.
jevois::UserInterface::Type::Stdio
@ Stdio
jevois
Definition:
Concepts.dox:1
Component.H
jevois::UserInterface::UserInterface
UserInterface(std::string const &instance)
Constructor.
Definition:
UserInterface.C:21
jevois::UserInterface::Type
Type
Enum for the interface type.
Definition:
UserInterface.H:59
jevois::UserInterface::Type::USB
@ USB
jevois::UserInterface::Type::GUI
@ GUI
jevois::UserInterface::type
virtual Type type() const =0
Derived classes must implement this and return their interface type.
include
jevois
Core
UserInterface.H
Please help us improve this page: Edit it on
GitHub
or
email us your edits and suggestions.
Generated by
1.8.17