Emojicode Documentation 1.0 beta 2

Value Type 🧠

Represents a region in memory.

Working with 🧠 requires great care as this interface allows you to directly manipulate memory.

Caution

When working with this class make sure to take into account that it is up to you to make sure that object life-time is properly managed. Especially, pay attention to the notes for ♻️ and 🚜.

It’s important to understand that instances of 🧠 are basically memory addresses. Always think of a 🧠 instance as pointing to a memory region. Because 🧠 instance always are addresses it is recommmended that you make no more copies than absolutely necessary to avoid unwanted side effects.

It is not possible to directly manipulate or access memory addresses as this would interfer with the automatic memory management Emojicode provides.

Initializers

πŸ†•

☣️ πŸ–  πŸ†•  size πŸ”’ 

Creates an instance by allocating size bytes.

Methods

🐽➑️

☣️ ➑️ 🐽🐚TβšͺοΈπŸ† 🎍πŸ₯‘ value T  offset πŸ”’ 

Writes value starting offset bytes past the address represented by this instance.

Hint

If the memory area represented is smaller than βš–οΈT βž• offset bytes, undefined behavior is caused!

πŸ½β—οΈ

☣️ ❗️ 🐽🐚TβšͺοΈπŸ†  offset πŸ”’ ➑️ ✴️T

Reads a value of type T starting bytes bytes past the address represented by this instance.

Hint

If the memory area represented is smaller than βš–οΈT βž• offset bytes, the behavior is undefined!

If the value at specified location is not exactly of type T or, in the case T is a class type, a subclass of T, the behavior is undefined!

πŸ—β—οΈ

☣️ πŸ– ❗️ πŸ—  newSize πŸ”’ 

Resizes this memory area.

Caution

Do not call this method if you have copies of this 🧠, i.e. if you have multiple pointers to this area. Calling this method updates the represented address and can invalidate all other 🧠 that pointed to this address. Only ever call this method if there is only one 🧠 representing the memory area.

♻❗️

☣️ ❗️ β™»πŸšTβšͺοΈπŸ†  offset πŸ”’ 

Releases a value of type T that is located offset bytes past the beginning of this memory area.

This method might not actually write to the memory, but it is crucial that you call it on every value that was placed in the memory area that you no longer need.

Caution

Release every value placed in the memory area with this method before overwritting it or entirely abandoning this 🧠 instance!

πŸšœβ—οΈ

☣️ ❗️ 🚜  destinationOffset πŸ”’  source 🧠  sourceOffset πŸ”’  bytes πŸ”’ 

Copies bytes bytes from source starting from sourceOffset to this instane, writing the copied bytes destinationOffset bytes past the beginning of this memory area.

source may be the same as the instance on which the method is called and the memory area which is copied may overlap the destination area.

Hint

If the memory area represented is smaller than bytes βž• destinationOffset bytes or source is smaller than bytes βž• sourceOffset bytes, undefined behavior is caused!

Caution

Do not copy managed values using this method! Copy each value individually with 🐽 and ➑️ 🐽!

βœβ—οΈ

☣️ ❗️ ✍  byteValue πŸ’§  offset πŸ”’  bytes πŸ”’ 

Sets the first bytes bytes starting from offset bytes past the address represented by this instance to byteValue.

Hint

If the memory area represented is smaller than bytes βž• offset bytes, undefined behavior is caused!

↔❗️

☣️ ❗️ ↔  other 🧠  bytes πŸ”’ ➑️ πŸ”’

Compares the first bytes of two memory areas.

Hint

If either the memory area represented by this instance or the one represented by other or both are smaller than bytes, undefined behavior is caused!