LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
device.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_LIBRARY_DEVICE_H
21 #define LIBREPCB_LIBRARY_DEVICE_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../libraryelement.h"
27 #include "devicepadsignalmap.h"
28 
30 
31 #include <QtCore>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 namespace library {
38 
39 /*******************************************************************************
40  * Class Device
41  ******************************************************************************/
42 
54 class Device final : public LibraryElement {
55  Q_OBJECT
56 
57 public:
58  // Constructors / Destructor
59  Device() = delete;
60  Device(const Device& other) = delete;
61  Device(const Uuid& uuid, const Version& version, const QString& author,
62  const ElementName& name_en_US, const QString& description_en_US,
63  const QString& keywords_en_US, const Uuid& component,
64  const Uuid& package);
65  explicit Device(std::unique_ptr<TransactionalDirectory> directory);
66  ~Device() noexcept;
67 
68  // Getters
69  const Uuid& getComponentUuid() const noexcept { return mComponentUuid; }
70  const Uuid& getPackageUuid() const noexcept { return mPackageUuid; }
71  const AttributeList& getAttributes() const noexcept { return mAttributes; }
73  const DevicePadSignalMap& getPadSignalMap() const noexcept {
74  return mPadSignalMap;
75  }
76 
77  // Setters
78  void setComponentUuid(const Uuid& uuid) noexcept;
79  void setPackageUuid(const Uuid& uuid) noexcept;
80 
81  // Operator Overloadings
82  Device& operator=(const Device& rhs) = delete;
83 
84  // Static Methods
85  static QString getShortElementName() noexcept {
86  return QStringLiteral("dev");
87  }
88  static QString getLongElementName() noexcept {
89  return QStringLiteral("device");
90  }
91 
92 signals:
93  void componentUuidChanged(const Uuid& uuid);
94  void packageUuidChanged(const Uuid& uuid);
95 
96 private: // Methods
98  void serialize(SExpression& root) const override;
99 
100 private: // Data
106 };
107 
108 /*******************************************************************************
109  * End of File
110  ******************************************************************************/
111 
112 } // namespace library
113 } // namespace librepcb
114 
115 #endif // LIBREPCB_LIBRARY_DEVICE_H
void serialize(SExpression &root) const override
Serialize the object into an existing S-Expression node.
Definition: device.cpp:84
DevicePadSignalMap & getPadSignalMap() noexcept
Definition: device.h:72
The Version class represents a version number in the format "1.42.7".
Definition: version.h:60
void componentUuidChanged(const Uuid &uuid)
void setComponentUuid(const Uuid &uuid) noexcept
Definition: device.cpp:68
Device & operator=(const Device &rhs)=delete
const Uuid & getComponentUuid() const noexcept
Definition: device.h:69
The Device class represents an instance of a component (a "real" component)
Definition: device.h:54
DevicePadSignalMap mPadSignalMap
Definition: device.h:105
const AttributeList & getAttributes() const noexcept
Definition: device.h:71
Uuid mComponentUuid
Definition: device.h:101
static QString getShortElementName() noexcept
Definition: device.h:85
void packageUuidChanged(const Uuid &uuid)
AttributeList mAttributes
not yet used, but already specified in file format
Definition: device.h:104
Uuid mPackageUuid
Definition: device.h:102
~Device() noexcept
Definition: device.cpp:61
void setPackageUuid(const Uuid &uuid) noexcept
Definition: device.cpp:74
static QString getLongElementName() noexcept
Definition: device.h:88
The LibraryElement class extends the LibraryBaseElement class with some attributes and methods which ...
Definition: libraryelement.h:45
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The SExpression class.
Definition: sexpression.h:60
const DevicePadSignalMap & getPadSignalMap() const noexcept
Definition: device.h:73
const Uuid & getPackageUuid() const noexcept
Definition: device.h:70
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition: elementname.h:92