Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
d11aef13
Commit
d11aef13
authored
Sep 09, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support copy constructor
parent
f323f850
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
14 deletions
+79
-14
Fact.cc
src/FactSystem/Fact.cc
+36
-12
Fact.h
src/FactSystem/Fact.h
+5
-2
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+34
-0
FactMetaData.h
src/FactSystem/FactMetaData.h
+4
-0
No files found.
src/FactSystem/Fact.cc
View file @
d11aef13
...
...
@@ -28,25 +28,49 @@
#include <QtQml>
Fact
::
Fact
(
void
)
:
_componentId
(
-
1
),
_value
(
0
),
_type
(
FactMetaData
::
valueTypeInt32
),
_metaData
(
NULL
)
Fact
::
Fact
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_componentId
(
-
1
)
,
_value
(
0
)
,
_type
(
FactMetaData
::
valueTypeInt32
)
,
_metaData
(
NULL
)
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
setMetaData
(
metaData
);
}
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
),
_name
(
name
),
_componentId
(
componentId
),
_value
(
0
),
_type
(
type
),
_metaData
(
NULL
)
Fact
::
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_name
(
name
)
,
_componentId
(
componentId
)
,
_value
(
0
)
,
_type
(
type
)
,
_metaData
(
NULL
)
{
FactMetaData
*
metaData
=
new
FactMetaData
(
_type
,
this
);
setMetaData
(
metaData
);
}
Fact
::
Fact
(
const
Fact
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
const
Fact
&
Fact
::
operator
=
(
const
Fact
&
other
)
{
_name
=
other
.
_name
;
_componentId
=
other
.
_componentId
;
_value
=
other
.
_value
;
_type
=
other
.
_type
;
if
(
_metaData
&&
other
.
_metaData
)
{
*
_metaData
=
*
other
.
_metaData
;
}
else
{
_metaData
=
NULL
;
}
return
*
this
;
}
void
Fact
::
forceSetValue
(
const
QVariant
&
value
)
...
...
src/FactSystem/Fact.h
View file @
d11aef13
...
...
@@ -40,9 +40,12 @@ class Fact : public QObject
Q_OBJECT
public:
Fact
(
void
);
Fact
(
QObject
*
parent
=
NULL
);
Fact
(
int
componentId
,
QString
name
,
FactMetaData
::
ValueType_t
type
,
QObject
*
parent
=
NULL
);
Fact
(
const
Fact
&
other
,
QObject
*
parent
=
NULL
);
const
Fact
&
operator
=
(
const
Fact
&
other
);
Q_PROPERTY
(
int
componentId
READ
componentId
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QVariant
value
READ
value
WRITE
setValue
NOTIFY
valueChanged
USER
true
)
...
...
src/FactSystem/FactMetaData.cc
View file @
d11aef13
...
...
@@ -32,6 +32,20 @@
#include <limits>
FactMetaData
::
FactMetaData
(
QObject
*
parent
)
:
QObject
(
parent
),
_group
(
"*Default Group"
),
_type
(
valueTypeInt32
),
_defaultValue
(
0
),
_defaultValueAvailable
(
false
),
_min
(
_minForType
()),
_max
(
_maxForType
()),
_minIsDefaultForType
(
true
),
_maxIsDefaultForType
(
true
)
{
}
FactMetaData
::
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
)
:
QObject
(
parent
),
_group
(
"*Default Group"
),
...
...
@@ -46,6 +60,26 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent) :
}
FactMetaData
::
FactMetaData
(
const
FactMetaData
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
const
FactMetaData
&
FactMetaData
::
operator
=
(
const
FactMetaData
&
other
)
{
_group
=
other
.
_group
;
_type
=
other
.
_type
;
_defaultValue
=
other
.
_defaultValue
;
_defaultValueAvailable
=
other
.
_defaultValueAvailable
;
_min
=
other
.
_min
;
_max
=
other
.
_max
;
_minIsDefaultForType
=
other
.
_minIsDefaultForType
;
_maxIsDefaultForType
=
other
.
_maxIsDefaultForType
;
return
*
this
;
}
QVariant
FactMetaData
::
defaultValue
(
void
)
{
if
(
_defaultValueAvailable
)
{
...
...
src/FactSystem/FactMetaData.h
View file @
d11aef13
...
...
@@ -52,7 +52,11 @@ public:
valueTypeDouble
}
ValueType_t
;
FactMetaData
(
QObject
*
parent
=
NULL
);
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
=
NULL
);
FactMetaData
(
const
FactMetaData
&
other
,
QObject
*
parent
=
NULL
);
const
FactMetaData
&
operator
=
(
const
FactMetaData
&
other
);
// Property accessors
QString
name
(
void
)
{
return
_name
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment