Skip to content

Commit

Permalink
v5.0.14-RC: Added ScalaDocs for CoreXXX classes
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Apr 4, 2024
1 parent fcb7229 commit 5899701
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/sigma/data/SigmaPropCodes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sigma.data
import sigma.ast.TypeCodes.LastConstantCode
import supertagged.TaggedType

/** Encoding of sigma proposition nodes.
/** Opcodes of sigma proposition nodes.
*
* @see SigmaBoolean.opCode
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import scorex.util.serialization.{VLQByteBufferWriter, Writer}
import sigma.ast.SType
import sigma.serialization.CoreByteWriter.{Bits, DataInfo, U, Vlq, ZigZag}

/** Implementation of [[Writer]] provided by `sigma-core` module.
* @param w destination [[Writer]] to which all the call got delegated.
*/
class CoreByteWriter(val w: Writer) extends Writer {
type CH = w.CH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@ import sigma.data.SigmaConstants

import java.nio.ByteBuffer

/** Implementation of [[Serializer]] provided by `sigma-core` module. */
abstract class CoreSerializer[TFamily, T <: TFamily] extends Serializer[TFamily, T, CoreByteReader, CoreByteWriter] {

def error(msg: String) = throw new SerializerException(msg, None)
def error(msg: String) = throw SerializerException(msg, None)

/** Serializes the given 'obj' to a new array of bytes using this serializer. */
final def toBytes(obj: T): Array[Byte] = {
val w = CoreSerializer.startWriter()
serialize(obj, w)
w.toBytes
}

/** Deserializes `bytes` to an object of this [[TFamily]] using this serializer.
* The actual class of the returned object is expected to be descendant of [[TFamily]].
*/
final def fromBytes(bytes: Array[Byte]): TFamily = {
parse(CoreSerializer.startReader(bytes))
}
}

object CoreSerializer {
type Position = Int

/** Max length of Box.propositionBytes collection */
val MaxPropositionSize: Int = SigmaConstants.MaxPropositionBytes.value

/** Max tree depth should not be greater then provided value */
val MaxTreeDepth: Int = SigmaConstants.MaxTreeDepth.value

/** Helper function to be use in serializers.
Expand Down

0 comments on commit 5899701

Please sign in to comment.