Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GlobalVariables.h « ObjectModel « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b58df922f5401998e75e383129661c93f9e592d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * GlobalVariables.h
 *
 *  Created on: 31 Mar 2021
 *      Author: David
 */

#ifndef SRC_OBJECTMODEL_GLOBALVARIABLES_H_
#define SRC_OBJECTMODEL_GLOBALVARIABLES_H_

#include "ObjectModel.h"
#include "Variable.h"
#include <RTOSIface/RTOSIface.h>

class GlobalVariables INHERIT_OBJECT_MODEL
{
public:
	GlobalVariables() noexcept { }

	ReadLockedPointer<const VariableSet> GetForReading() noexcept;
	WriteLockedPointer<VariableSet> GetForWriting() noexcept;

	VariableSet& GetVariables() noexcept { return vars; }

protected:
	DECLARE_OBJECT_MODEL

	// Construct a JSON representation of those parts of the object model requested by the user
	// This overrides the standard definition because the variable names are not fixed
	void ReportAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ObjectModelClassDescriptor * null classDescriptor, uint8_t tableNumber, const char *_ecv_array filter) const noexcept override
			THROWS(GCodeException);

private:
	VariableSet vars;
	mutable ReadWriteLock lock;
};

#endif /* SRC_OBJECTMODEL_GLOBALVARIABLES_H_ */