File indexing completed on 2024-05-12 05:25:58

0001 /*
0002  *   Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU General Public License as published by
0006  *   the Free Software Foundation; either version 2 of the License, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details.
0013  *
0014  *   You should have received a copy of the GNU General Public License
0015  *   along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
0018  */
0019 #pragma once
0020 
0021 #include "sink_export.h"
0022 #include <QSharedPointer>
0023 
0024 class TypeIndex;
0025 namespace Sink {
0026 namespace ApplicationDomain {
0027 class BufferAdaptor;
0028 class ApplicationDomainType;
0029 }
0030 struct Entity;
0031 }
0032 
0033 namespace flatbuffers {
0034 class FlatBufferBuilder;
0035 }
0036 
0037 class SINK_EXPORT DomainTypeAdaptorFactoryInterface
0038 {
0039 public:
0040     typedef QSharedPointer<DomainTypeAdaptorFactoryInterface> Ptr;
0041     virtual ~DomainTypeAdaptorFactoryInterface(){};
0042     virtual QSharedPointer<Sink::ApplicationDomain::BufferAdaptor> createAdaptor(const Sink::Entity &entity, TypeIndex *index = nullptr) = 0;
0043 
0044     /*
0045      * Creates a buffer from @param domainType
0046      *
0047      * Note that this only serialized parameters that are part of ApplicationDomainType::changedProperties()
0048      */
0049     virtual bool
0050     createBuffer(const Sink::ApplicationDomain::ApplicationDomainType &domainType, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = nullptr, size_t metadataSize = 0) = 0;
0051     virtual bool createBuffer(const QSharedPointer<Sink::ApplicationDomain::BufferAdaptor> &bufferAdaptor, flatbuffers::FlatBufferBuilder &fbb, void const *metadataData = nullptr, size_t metadataSize = 0) = 0;
0052 };