Dreamine.PLC.Core 1.0.1
Dreamine.PLC.Core 산업 자동화 및 I/O 기능을 제공합니다.
로딩중...
검색중...
일치하는것 없음
Dreamine.PLC.Core.Memory.InMemoryPlcMemory 클래스 참조sealed

더 자세히 ...

Public 멤버 함수

PlcResult< bool[]> ReadBits (PlcAddress address, int count)
PlcResult< short[]> ReadWords (PlcAddress address, int count)
PlcResult WriteBits (PlcAddress address, IReadOnlyList< bool > values)
PlcResult WriteWords (PlcAddress address, IReadOnlyList< short > values)
void Clear ()

Private 멤버 함수

Dictionary< int, short > GetOrCreateWordArea (PlcDeviceType deviceType)
Dictionary< int, bool > GetOrCreateBitArea (PlcDeviceType deviceType)

Private 속성

readonly object _syncRoot = new()
readonly Dictionary< PlcDeviceType, Dictionary< int, short > > _words = new()
readonly Dictionary< PlcDeviceType, Dictionary< int, bool > > _bits = new()

상세한 설명

메모리 기반 PLC 디바이스 저장소를 제공합니다.

InMemoryPlcMemory.cs 파일의 14 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ Clear()

void Dreamine.PLC.Core.Memory.InMemoryPlcMemory.Clear ( )
inline

모든 비트 및 워드 메모리 영역을 지웁니다.

InMemoryPlcMemory.cs 파일의 266 번째 라인에서 정의되었습니다.

267 {
268 lock (_syncRoot)
269 {
270 _bits.Clear();
271 _words.Clear();
272 }
273 }

다음을 참조함 : _bits, _syncRoot, _words.

◆ GetOrCreateBitArea()

Dictionary< int, bool > Dreamine.PLC.Core.Memory.InMemoryPlcMemory.GetOrCreateBitArea ( PlcDeviceType deviceType)
inlineprivate

지정한 디바이스 타입의 비트 영역을 가져오거나 만듭니다.

매개변수
deviceType디바이스 타입입니다.
반환값
비트 영역 사전입니다.

InMemoryPlcMemory.cs 파일의 334 번째 라인에서 정의되었습니다.

335 {
336 if (!_bits.TryGetValue(deviceType, out var area))
337 {
338 area = new Dictionary<int, bool>();
339 _bits[deviceType] = area;
340 }
341
342 return area;
343 }

다음을 참조함 : _bits.

다음에 의해서 참조됨 : ReadBits(), WriteBits().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetOrCreateWordArea()

Dictionary< int, short > Dreamine.PLC.Core.Memory.InMemoryPlcMemory.GetOrCreateWordArea ( PlcDeviceType deviceType)
inlineprivate

지정한 디바이스 타입의 워드 영역을 가져오거나 만듭니다.

매개변수
deviceType디바이스 타입입니다.
반환값
워드 영역 사전입니다.

InMemoryPlcMemory.cs 파일의 299 번째 라인에서 정의되었습니다.

300 {
301 if (!_words.TryGetValue(deviceType, out var area))
302 {
303 area = new Dictionary<int, short>();
304 _words[deviceType] = area;
305 }
306
307 return area;
308 }

다음을 참조함 : _words.

다음에 의해서 참조됨 : ReadWords(), WriteWords().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ReadBits()

PlcResult< bool[]> Dreamine.PLC.Core.Memory.InMemoryPlcMemory.ReadBits ( PlcAddress address,
int count )
inline

메모리 저장소에서 비트 값을 읽습니다.

매개변수
address시작 주소입니다.
count읽을 비트 수입니다.
반환값
읽은 비트 결과입니다.

InMemoryPlcMemory.cs 파일의 76 번째 라인에서 정의되었습니다.

77 {
78 if (count <= 0)
79 {
80 return PlcResult<bool[]>.Failure("The read count must be greater than zero.");
81 }
82
83 lock (_syncRoot)
84 {
85 var values = new bool[count];
86 var area = GetOrCreateBitArea(address.DeviceType);
87
88 for (var i = 0; i < count; i++)
89 {
90 var offset = address.Offset + i;
91 values[i] = area.TryGetValue(offset, out var value) && value;
92 }
93
94 return PlcResult<bool[]>.Success(values);
95 }
96 }

다음을 참조함 : _syncRoot, GetOrCreateBitArea().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ ReadWords()

PlcResult< short[]> Dreamine.PLC.Core.Memory.InMemoryPlcMemory.ReadWords ( PlcAddress address,
int count )
inline

메모리 저장소에서 워드 값을 읽습니다.

매개변수
address시작 주소입니다.
count읽을 워드 수입니다.
반환값
읽은 워드 결과입니다.

InMemoryPlcMemory.cs 파일의 130 번째 라인에서 정의되었습니다.

131 {
132 if (count <= 0)
133 {
134 return PlcResult<short[]>.Failure("The read count must be greater than zero.");
135 }
136
137 lock (_syncRoot)
138 {
139 var values = new short[count];
140 var area = GetOrCreateWordArea(address.DeviceType);
141
142 for (var i = 0; i < count; i++)
143 {
144 var offset = address.Offset + i;
145 values[i] = area.TryGetValue(offset, out var value) ? value : default;
146 }
147
148 return PlcResult<short[]>.Success(values);
149 }
150 }

다음을 참조함 : _syncRoot, GetOrCreateWordArea().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ WriteBits()

PlcResult Dreamine.PLC.Core.Memory.InMemoryPlcMemory.WriteBits ( PlcAddress address,
IReadOnlyList< bool > values )
inline

메모리 저장소에 비트 값을 씁니다.

매개변수
address시작 주소입니다.
values쓸 비트 값입니다.
반환값
쓰기 결과입니다.

InMemoryPlcMemory.cs 파일의 184 번째 라인에서 정의되었습니다.

185 {
186 if (values.Count == 0)
187 {
188 return PlcResult.Failure("The bit value collection must not be empty.");
189 }
190
191 lock (_syncRoot)
192 {
193 var area = GetOrCreateBitArea(address.DeviceType);
194
195 for (var i = 0; i < values.Count; i++)
196 {
197 var offset = address.Offset + i;
198 area[offset] = values[i];
199 }
200
201 return PlcResult.Success();
202 }
203 }

다음을 참조함 : _syncRoot, GetOrCreateBitArea().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ WriteWords()

PlcResult Dreamine.PLC.Core.Memory.InMemoryPlcMemory.WriteWords ( PlcAddress address,
IReadOnlyList< short > values )
inline

메모리 저장소에 워드 값을 씁니다.

매개변수
address시작 주소입니다.
values쓸 워드 값입니다.
반환값
쓰기 결과입니다.

InMemoryPlcMemory.cs 파일의 237 번째 라인에서 정의되었습니다.

238 {
239 if (values.Count == 0)
240 {
241 return PlcResult.Failure("The word value collection must not be empty.");
242 }
243
244 lock (_syncRoot)
245 {
246 var area = GetOrCreateWordArea(address.DeviceType);
247
248 for (var i = 0; i < values.Count; i++)
249 {
250 var offset = address.Offset + i;
251 area[offset] = values[i];
252 }
253
254 return PlcResult.Success();
255 }
256 }

다음을 참조함 : _syncRoot, GetOrCreateWordArea().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _bits

readonly Dictionary<PlcDeviceType, Dictionary<int, bool> > Dreamine.PLC.Core.Memory.InMemoryPlcMemory._bits = new()
private

bits 값을 보관합니다.

InMemoryPlcMemory.cs 파일의 42 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : Clear(), GetOrCreateBitArea().

◆ _syncRoot

readonly object Dreamine.PLC.Core.Memory.InMemoryPlcMemory._syncRoot = new()
private

sync Root 값을 보관합니다.

InMemoryPlcMemory.cs 파일의 24 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : Clear(), ReadBits(), ReadWords(), WriteBits(), WriteWords().

◆ _words

readonly Dictionary<PlcDeviceType, Dictionary<int, short> > Dreamine.PLC.Core.Memory.InMemoryPlcMemory._words = new()
private

words 값을 보관합니다.

InMemoryPlcMemory.cs 파일의 33 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : Clear(), GetOrCreateWordArea().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: