본문으로 건너뛰기
로딩중...
검색중...
일치하는것 없음
glsEditSession.h
1#pragma once
2#include "gdk_dll/glsTypes.h"
3#include "gdk_dll/glsBufferedEdit.h"
4#include <cstdint>
5
6namespace GDK {
7namespace dll::spatial { struct EditBatchAccess; }
8
9class glsMapView;
10class glsFeature;
12
13// Lets glsEditSessionState suspend and drain in-flight reads (e.g.
14// attribute-table async page/count loads) before a commit touches the same
15// physical source.
21public:
23 virtual ~IGlsEditReadGate() = default;
28 virtual const char* LayerId() const noexcept = 0;
31 virtual void SetReadsSuspended(bool suspended) noexcept = 0;
37 virtual bool CancelAndDrain(int timeoutMs) noexcept = 0;
38};
39
45public:
47 virtual ~IGlsEditSessionObserver() = default;
52 virtual void OnStateChanged(const char* layerId) noexcept = 0;
58 virtual void OnCommitted(const char* layerId, const struct glsEditSessionCommitResult& result) noexcept = 0;
59};
60
61// Internal-facing, multi-subscriber entry lifecycle events (the host keeps
62// the single SetObserver slot). glsEditController subscribes to purge its
63// undo history.
71public:
73 virtual ~IGlsEditEntryListener() = default;
77 virtual void OnEntryCommitted(uint64_t entryKey, bool succeeded) noexcept = 0;
82 virtual void OnEntryRolledBack(uint64_t entryKey) noexcept = 0;
87 virtual void OnEntryReleased(uint64_t entryKey) noexcept = 0;
88};
89
100
101// Owns one glsBufferedEditWorkspace per physical glsDataSource, grouping
102// every map layer that aliases the same source. Shared by qt_gdk_dll and
103// gdk_cli2 -- see
104// docs/superpowers/specs/2026-09-22-buffered-edit-coordinator-unification-design.md.
105// Locking: every public method takes one internal std::recursive_mutex for
106// its whole body, except Commit(), which holds it only for its start/end
107// bookkeeping and releases it across the read-gate drain and the native
108// workspace commit. Staging methods and Rollback on the entry being
109// committed check its atomic committing flag and refuse.
117public:
126 static glsStatus IsSourceBeingEdited(glsDataSource* source,bool* out) noexcept;
132 glsEditSessionState& operator=(const glsEditSessionState&) = delete;
133
134 // Scans every feature layer in view (including nested glsGroupLayer
135 // children), attaches every one that shares layerId's physical
136 // glsDataSource (glsDataSource::IsSameSource) and remaps each attached
137 // layer's selection with glsFeatureLayer::RemapSelectionToViewIds.
140
147 glsStatus TryBeginEdit(glsMapView* view, const char* layerId) noexcept;
151 bool IsEditing(const char* layerId) const noexcept;
152
153 // Every id/viewId argument below is a workspace view id, already resolved
154 // by the caller via the layer's effective/overlay data source -- these
155 // methods do not translate ids.
163 glsStatus TryAddFeature(const char* layerId, const glsFeature* feature, int64_t* outViewId) noexcept;
164 // Stages ONLY geometry -- does not touch any attribute slot, so a prior
165 // still-uncommitted attribute edit on the same feature survives.
173 glsStatus TryUpdateFeatureGeometry(const char* layerId, int64_t viewId, const glsFeature* feature) noexcept;
174 // Stages every populated attribute slot on feature (full attribute-set
175 // replace) -- does not touch geometry.
183 glsStatus TryUpdateFeatureAttributes(const char* layerId, int64_t viewId, const glsFeature* feature) noexcept;
192 glsStatus TryUpdateFeatureAttribute(const char* layerId, int64_t viewId, int fieldIndex, const glsAttributeValue* value) noexcept;
193 // Single pass in id order. If one id fails partway, earlier-staged ids in
194 // this same call are NOT rolled back (matches Qt's documented gap --
195 // glsBufferedEditWorkspace has no per-feature unstage primitive).
203 glsStatus TryDeleteFeatures(const char* layerId, const int64_t* viewIds, int count) noexcept;
205
208
215 int64_t ViewIdForSourceId(const char* layerId, int64_t sourceId) const noexcept;
224 glsStatus ViewIdsForSourceIds(const char* layerId, const int64_t* sourceIds, int count,
225 int64_t* outViewIds) const noexcept;
226
227 // Exists so a host can read per-feature pending state (IsPendingDelete/
228 // IsPendingInsert/GetPendingAttribute) that this class's own surface does
229 // not expose.
236 glsStatus GetWorkspace(const char* layerId, glsBufferedEditWorkspace** outWorkspace) const noexcept;
237
241 int AliasCount(const char* layerId) const noexcept;
242
244
247
253 glsStatus Rollback(const char* layerId) noexcept;
254
255 // Exists to let a caller restore Rollback's pre-shared-class behavior of
256 // clearing every alias's selection after a successful Rollback()
257 // (gdk_cli2's NativeBufferedEditCoordinator calls it; Qt's
258 // EditWorkspaceCoordinator::rollback() does not).
265 glsStatus ClearAliasSelections(glsMapView* view, const char* layerId) noexcept;
272 glsStatus EndEdit(glsMapView* view, const char* layerId) noexcept;
273 // Conditional finish: never discards edits staged after a save callback.
280 glsStatus EndEditIfClean(glsMapView* view,const char* layerId) noexcept;
287 glsStatus DiscardEntry(glsMapView* view, const char* layerId) noexcept;
288 // Does not hold this class's internal mutex across the drain/native
289 // commit (see the class comment above).
296 glsStatus Commit(const char* layerId, glsEditSessionCommitResult* outResult) noexcept;
297 // An entry mid-commit is left untouched for its own Commit() call to
298 // clean up -- removing it here while a commit is draining read gates
299 // (which may pump a host event loop and re-enter this class) would
300 // destroy a native workspace still attached to a live layer.
305 void Reset(glsMapView* view) noexcept;
306
308
311
315 bool IsCommitting(const char* layerId) const noexcept;
321 bool IsOutcomeUnknown(const char* layerId) const noexcept;
325 bool HasPendingChanges(const char* layerId) const noexcept;
328 bool HasAnyPendingChanges() const noexcept;
332 int64_t InsertedCount(const char* layerId) const noexcept;
336 int64_t UpdatedCount(const char* layerId) const noexcept;
340 int64_t DeletedCount(const char* layerId) const noexcept;
341
343
346
351 void SetObserver(IGlsEditSessionObserver* observer) noexcept;
356 void RegisterReadGate(IGlsEditReadGate* gate) noexcept;
360
366 uint64_t EntryKey(const char* layerId) const noexcept;
373 glsStatus GetAnyLayerIdForEntry(uint64_t entryKey, char* buf, size_t bufSize, size_t* requiredSize) const noexcept;
378 glsStatus GetEntryRevision(uint64_t entryKey, uint64_t* outRevision) const noexcept;
382 bool IsEntryCommitting(uint64_t entryKey) const noexcept;
386 bool IsEntryOutcomeUnknown(uint64_t entryKey) const noexcept;
395 glsStatus CaptureChanges(uint64_t entryKey, const int64_t* viewIds, int count,
396 glsEditChangeSnapshot** outSnapshot) const noexcept;
404 glsStatus RestoreChanges(uint64_t entryKey, const glsEditChangeSnapshot* snapshot,
405 uint64_t expectedRevision = 0) noexcept;
410 void AddEntryListener(IGlsEditEntryListener* listener) noexcept;
416
418
419private:
420 friend class glsEditController;
421 friend struct dll::spatial::EditBatchAccess;
422 glsStatus CommitExpectedEntry(const char* layerId,uint64_t expectedEntryKey,glsEditSessionCommitResult* outResult) noexcept;
423 glsStatus EndEditIfCleanExpected(glsMapView* view,const char* layerId,uint64_t expectedEntryKey) noexcept;
424 struct Entry;
425 struct Impl;
426 Impl* impl_;
427};
428
429} // namespace GDK
한 원본을 공유하는 편집 항목의 수명 이벤트를 받습니다.
정의 glsEditSession.h:70
virtual void OnEntryReleased(uint64_t entryKey) noexcept=0
공유 편집 항목의 종료를 알립니다.
virtual ~IGlsEditEntryListener()=default
콜백 인터페이스 구현 객체를 해제합니다.
virtual void OnEntryCommitted(uint64_t entryKey, bool succeeded) noexcept=0
공유 항목의 저장 시도가 끝난 뒤 알립니다.
virtual void OnEntryRolledBack(uint64_t entryKey) noexcept=0
공유 항목의 변경 폐기를 알립니다.
레이어 편집을 저장하는 동안 애플리케이션 읽기를 제어하는 인터페이스입니다.
정의 glsEditSession.h:20
virtual bool CancelAndDrain(int timeoutMs) noexcept=0
대기 읽기를 취소하고 실행 중 읽기가 끝날 때까지 기다립니다.
virtual const char * LayerId() const noexcept=0
게이트가 읽는 레이어를 식별합니다.
virtual void SetReadsSuspended(bool suspended) noexcept=0
새 읽기 예약 가능 여부를 변경합니다.
virtual ~IGlsEditReadGate()=default
콜백 인터페이스 구현 객체를 해제합니다.
레이어 편집 상태 변경과 저장을 받는 관찰자입니다.
정의 glsEditSession.h:44
virtual void OnStateChanged(const char *layerId) noexcept=0
레이어의 편집 상태가 바뀐 뒤 호출합니다.
virtual void OnCommitted(const char *layerId, const struct glsEditSessionCommitResult &result) noexcept=0
공급자 저장 시도가 끝난 결과를 알립니다.
virtual ~IGlsEditSessionObserver()=default
콜백 인터페이스 구현 객체를 해제합니다.
한 데이터 소스의 보류 변경을 관리하는 작업공간입니다.
정의 glsBufferedEdit.h:65
데이터셋에서 연 벡터 피처 테이블입니다.
정의 glsDataset.h:177
int64_t UpdatedCount(const char *layerId) const noexcept
삭제 예정이 아닌 변경된 원본 피처 수를 조회합니다.
glsStatus TryBeginEdit(glsMapView *view, const char *layerId) noexcept
피처 레이어의 편집을 열거나 같은 원본의 열린 편집에 연결합니다.
glsStatus ClearAliasSelections(glsMapView *view, const char *layerId) noexcept
편집 항목을 공유하는 레이어의 선택을 지웁니다.
bool IsEntryCommitting(uint64_t entryKey) const noexcept
공유 편집 항목의 저장이 진행 중인지 확인합니다.
bool HasAnyPendingChanges() const noexcept
어느 열린 편집이든 보류 변경이 있는지 판정합니다.
glsStatus EndEditIfClean(glsMapView *view, const char *layerId) noexcept
보류 변경이 없는 경우만 레이어 편집을 닫습니다.
void RemoveEntryListener(IGlsEditEntryListener *listener) noexcept
공유 항목의 수명 이벤트 리스너 등록을 해제합니다.
glsStatus ViewIdsForSourceIds(const char *layerId, const int64_t *sourceIds, int count, int64_t *outViewIds) const noexcept
열린 편집에서 원본 FID 여러 개를 한 번에 변환합니다.
glsStatus RestoreChanges(uint64_t entryKey, const glsEditChangeSnapshot *snapshot, uint64_t expectedRevision=0) noexcept
캡처한 보류 변경을 복원하고 모든 공유 레이어에 알립니다.
void SetObserver(IGlsEditSessionObserver *observer) noexcept
하나의 편집 상태 관찰자를 교체하거나 제거합니다.
glsStatus TryUpdateFeatureGeometry(const char *layerId, int64_t viewId, const glsFeature *feature) noexcept
기존 편집 ID의 기하 변경을 보류합니다.
uint64_t EntryKey(const char *layerId) const noexcept
레이어의 공유 편집 항목 키를 조회합니다.
int64_t InsertedCount(const char *layerId) const noexcept
레이어의 미저장 새 피처 수를 조회합니다.
static glsStatus IsSourceBeingEdited(glsDataSource *source, bool *out) noexcept
프로세스에서 해당 원본 테이블과 관련된 편집이나 DB 쓰기가 있는지 검사합니다.
glsStatus CaptureChanges(uint64_t entryKey, const int64_t *viewIds, int count, glsEditChangeSnapshot **outSnapshot) const noexcept
편집 ID의 보류 변경을 공유 항목에서 캡처합니다.
bool IsEntryOutcomeUnknown(uint64_t entryKey) const noexcept
공유 편집 항목의 최근 저장 결과 불명 여부를 확인합니다.
glsStatus TryUpdateFeatureAttribute(const char *layerId, int64_t viewId, int fieldIndex, const glsAttributeValue *value) noexcept
편집 ID의 한 필드에 새 값을 보류합니다.
void Reset(glsMapView *view) noexcept
모든 열린 편집에서 보류 변경을 버리고 편집을 닫습니다.
bool HasPendingChanges(const char *layerId) const noexcept
레이어의 열린 편집에 보류 변경이 있는지 판정합니다.
glsStatus TryUpdateFeatureAttributes(const char *layerId, int64_t viewId, const glsFeature *feature) noexcept
편집 ID에 설정한 속성 값을 하나씩 보류합니다.
glsStatus Rollback(const char *layerId) noexcept
하나의 원본을 공유하는 레이어의 보류 변경을 폐기합니다.
bool IsCommitting(const char *layerId) const noexcept
레이어의 보류 변경을 저장 중인지 판정합니다.
glsStatus GetWorkspace(const char *layerId, glsBufferedEditWorkspace **outWorkspace) const noexcept
열린 편집 항목의 버퍼 작업공간을 차용합니다.
glsStatus Commit(const char *layerId, glsEditSessionCommitResult *outResult) noexcept
레이어와 공유 레이어의 보류 변경을 원본에 저장합니다.
bool IsEditing(const char *layerId) const noexcept
레이어에 열린 편집이 있는지 확인합니다.
glsStatus TryAddFeature(const char *layerId, const glsFeature *feature, int64_t *outViewId) noexcept
편집 항목에 새 피처 삽입을 보류합니다.
bool IsOutcomeUnknown(const char *layerId) const noexcept
마지막 저장의 결과가 불명확한지 조회합니다.
glsStatus DiscardEntry(glsMapView *view, const char *layerId) noexcept
공유 항목의 보류 변경을 버리고 모든 연결 레이어 편집을 닫습니다.
glsStatus TryDeleteFeatures(const char *layerId, const int64_t *viewIds, int count) noexcept
배열 순서로 편집 피처 삭제를 보류합니다.
glsEditSessionState() noexcept
열린 편집이나 보류 변경이 없는 세션을 생성합니다.
void RegisterReadGate(IGlsEditReadGate *gate) noexcept
세션에 읽기 제어 게이트 하나를 등록합니다.
glsStatus GetEntryRevision(uint64_t entryKey, uint64_t *outRevision) const noexcept
공유 편집 항목의 보류 변경 세대 번호를 조회합니다.
void AddEntryListener(IGlsEditEntryListener *listener) noexcept
공유 편집 항목의 수명 이벤트 리스너를 등록합니다.
glsStatus GetAnyLayerIdForEntry(uint64_t entryKey, char *buf, size_t bufSize, size_t *requiredSize) const noexcept
공유 편집 항목에 연결된 레이어 ID 하나를 읽습니다.
int64_t DeletedCount(const char *layerId) const noexcept
삭제 예정 원본 피처 수를 조회합니다.
int AliasCount(const char *layerId) const noexcept
열린 편집 항목에 연결된 공유 레이어 수를 조회합니다.
void UnregisterReadGate(IGlsEditReadGate *gate) noexcept
지정 게이트의 모든 네이티브 등록을 제거합니다.
glsStatus EndEdit(glsMapView *view, const char *layerId) noexcept
지정한 레이어 하나의 편집을 닫습니다.
int64_t ViewIdForSourceId(const char *layerId, int64_t sourceId) const noexcept
열린 편집에서 원본 저장 FID를 편집 뷰 ID로 변환합니다.
FID, 속성, 지오메트리를 담는 변경 가능한 피처 레코드입니다.
정의 glsFeature.h:173
지도 화면·레이어·렌더링·피처 식별·스냅을 관리하는 뷰입니다.
정의 glsMapView.h:87
공개 gdk_dll API가 공유하는 값 형식, 결과 코드, 호출 규약입니다.
#define GDK_DLL_API
Windows에서는 SDK 심볼을 내보내거나 가져오고, 그 외 플랫폼에서는 SDK 빌드의 심볼을 공개합니다.
정의 glsExport.h:20
glsEditCommitOutcome
데이터 소스에 보류 편집을 저장한 결과 유형입니다.
정의 glsBufferedEdit.h:13
@ FailedRolledBack
쓰기가 실패하고 데이터 소스가 변경을 롤백했습니다. 아직 저장을 실행하지 않은 결과가 갖는 초기값이기도 합니다.
정의 glsBufferedEdit.h:23
glsGdk SDK의 네이티브 C++ API 이름 공간입니다.
정의 glsAttributeTable.h:5
형식 태그로 실제 값이 들어 있는 멤버를 지정하는 속성값입니다.
정의 glsTypes.h:1575
세션에서 시도한 공급자 저장의 결과 유형과 보류 건수입니다.
정의 glsEditSession.h:94
int64_t InsertedCount
저장에서 처리한 새 피처 수입니다.
정의 glsEditSession.h:96
glsEditCommitOutcome Outcome
저장 성공을 판정하는 결과 유형입니다.
정의 glsEditSession.h:95
int64_t UpdatedCount
저장에서 처리한 변경 원본 피처 수입니다.
정의 glsEditSession.h:97
int64_t DeletedCount
저장에서 처리한 삭제 예정 피처 수입니다.
정의 glsEditSession.h:98
DLL 경계의 공개 함수가 반환하는 상태입니다.
정의 glsTypes.h:83