// Compiled by ClojureScript 1.10.520 {}
goog.provide('octet.spec.basic');
goog.require('cljs.core');
goog.require('octet.buffer');
goog.require('octet.spec');
octet.spec.basic.primitive_spec = (function octet$spec$basic$primitive_spec(size,readfn,writefn){
if((typeof octet !== 'undefined') && (typeof octet.spec !== 'undefined') && (typeof octet.spec.basic !== 'undefined') && (typeof octet.spec.basic.t_octet$spec$basic27510 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
octet.spec.basic.t_octet$spec$basic27510 = (function (size,readfn,writefn,meta27511){
this.size = size;
this.readfn = readfn;
this.writefn = writefn;
this.meta27511 = meta27511;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
octet.spec.basic.t_octet$spec$basic27510.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27512,meta27511__$1){
var self__ = this;
var _27512__$1 = this;
return (new octet.spec.basic.t_octet$spec$basic27510(self__.size,self__.readfn,self__.writefn,meta27511__$1));
});

octet.spec.basic.t_octet$spec$basic27510.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27512){
var self__ = this;
var _27512__$1 = this;
return self__.meta27511;
});

octet.spec.basic.t_octet$spec$basic27510.prototype.call = (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});

octet.spec.basic.t_octet$spec$basic27510.prototype.apply = (function (self__,args27513){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args27513)));
});

octet.spec.basic.t_octet$spec$basic27510.prototype.cljs$core$IFn$_invoke$arity$0 = (function (){
var self__ = this;
var s = this;
return s;
});

octet.spec.basic.t_octet$spec$basic27510.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27510.prototype.octet$spec$ISpecSize$size$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.size;
});

octet.spec.basic.t_octet$spec$basic27510.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27510.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
var readed = self__.readfn.call(null,buff,pos);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.size,readed], null);
});

octet.spec.basic.t_octet$spec$basic27510.prototype.octet$spec$ISpec$write$arity$4 = (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var G__27514_27515 = value;
if((G__27514_27515 == null)){
} else {
self__.writefn.call(null,buff,pos,G__27514_27515);
}

return self__.size;
});

octet.spec.basic.t_octet$spec$basic27510.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"size","size",-1555742762,null),new cljs.core.Symbol(null,"readfn","readfn",1394986672,null),new cljs.core.Symbol(null,"writefn","writefn",1052701163,null),new cljs.core.Symbol(null,"meta27511","meta27511",343898540,null)], null);
});

octet.spec.basic.t_octet$spec$basic27510.cljs$lang$type = true;

octet.spec.basic.t_octet$spec$basic27510.cljs$lang$ctorStr = "octet.spec.basic/t_octet$spec$basic27510";

octet.spec.basic.t_octet$spec$basic27510.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"octet.spec.basic/t_octet$spec$basic27510");
});

/**
 * Positional factory function for octet.spec.basic/t_octet$spec$basic27510.
 */
octet.spec.basic.__GT_t_octet$spec$basic27510 = (function octet$spec$basic$primitive_spec_$___GT_t_octet$spec$basic27510(size__$1,readfn__$1,writefn__$1,meta27511){
return (new octet.spec.basic.t_octet$spec$basic27510(size__$1,readfn__$1,writefn__$1,meta27511));
});

}

return (new octet.spec.basic.t_octet$spec$basic27510(size,readfn,writefn,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Boolean type spec.
 */
octet.spec.basic.bool = (function (){
if((typeof octet !== 'undefined') && (typeof octet.spec !== 'undefined') && (typeof octet.spec.basic !== 'undefined') && (typeof octet.spec.basic.t_octet$spec$basic27516 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {cljs.core.IFn}
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
octet.spec.basic.t_octet$spec$basic27516 = (function (meta27517){
this.meta27517 = meta27517;
this.cljs$lang$protocol_mask$partition0$ = 393217;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
octet.spec.basic.t_octet$spec$basic27516.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27518,meta27517__$1){
var self__ = this;
var _27518__$1 = this;
return (new octet.spec.basic.t_octet$spec$basic27516(meta27517__$1));
});

octet.spec.basic.t_octet$spec$basic27516.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27518){
var self__ = this;
var _27518__$1 = this;
return self__.meta27517;
});

octet.spec.basic.t_octet$spec$basic27516.prototype.call = (function (self__){
var self__ = this;
var self____$1 = this;
var s = self____$1;
return s;
});

octet.spec.basic.t_octet$spec$basic27516.prototype.apply = (function (self__,args27519){
var self__ = this;
var self____$1 = this;
return self____$1.call.apply(self____$1,[self____$1].concat(cljs.core.aclone.call(null,args27519)));
});

octet.spec.basic.t_octet$spec$basic27516.prototype.cljs$core$IFn$_invoke$arity$0 = (function (){
var self__ = this;
var s = this;
return s;
});

octet.spec.basic.t_octet$spec$basic27516.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27516.prototype.octet$spec$ISpecSize$size$arity$1 = (function (__SHARP_){
var self__ = this;
var __SHARP___$1 = this;
return (1);
});

octet.spec.basic.t_octet$spec$basic27516.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27516.prototype.octet$spec$ISpec$read$arity$3 = (function (__SHARP_,buff,pos){
var self__ = this;
var __SHARP___$1 = this;
var readed = octet.buffer.read_byte.call(null,buff,pos);
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [(1),(function (){var pred__27520 = cljs.core._EQ_;
var expr__27521 = readed;
if(cljs.core.truth_(pred__27520.call(null,(0),expr__27521))){
return false;
} else {
if(cljs.core.truth_(pred__27520.call(null,(1),expr__27521))){
return true;
} else {
return null;
}
}
})()], null);
});

octet.spec.basic.t_octet$spec$basic27516.prototype.octet$spec$ISpec$write$arity$4 = (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
var value__$1 = (function (){var pred__27523 = cljs.core._EQ_;
var expr__27524 = value;
if(cljs.core.truth_(pred__27523.call(null,true,expr__27524))){
return (1);
} else {
if(cljs.core.truth_(pred__27523.call(null,false,expr__27524))){
return (0);
} else {
return (-1);
}
}
})();
octet.buffer.write_byte.call(null,buff,pos,value__$1);

return (1);
});

octet.spec.basic.t_octet$spec$basic27516.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"meta27517","meta27517",622269238,null)], null);
});

octet.spec.basic.t_octet$spec$basic27516.cljs$lang$type = true;

octet.spec.basic.t_octet$spec$basic27516.cljs$lang$ctorStr = "octet.spec.basic/t_octet$spec$basic27516";

octet.spec.basic.t_octet$spec$basic27516.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"octet.spec.basic/t_octet$spec$basic27516");
});

/**
 * Positional factory function for octet.spec.basic/t_octet$spec$basic27516.
 */
octet.spec.basic.__GT_t_octet$spec$basic27516 = (function octet$spec$basic$__GT_t_octet$spec$basic27516(meta27517){
return (new octet.spec.basic.t_octet$spec$basic27516(meta27517));
});

}

return (new octet.spec.basic.t_octet$spec$basic27516(cljs.core.PersistentArrayMap.EMPTY));
})()
;
/**
 * Byte type spec.
 */
octet.spec.basic.byte$ = octet.spec.basic.primitive_spec.call(null,(1),octet.buffer.read_byte,octet.buffer.write_byte);
/**
 * Short type spec.
 */
octet.spec.basic.int16 = octet.spec.basic.primitive_spec.call(null,(2),octet.buffer.read_short,octet.buffer.write_short);
/**
 * Integer type spec.
 */
octet.spec.basic.int32 = octet.spec.basic.primitive_spec.call(null,(4),octet.buffer.read_int,octet.buffer.write_int);
/**
 * Long type spec.
 */
octet.spec.basic.int64 = octet.spec.basic.primitive_spec.call(null,(8),octet.buffer.read_long,octet.buffer.write_long);
/**
 * Float type spec
 */
octet.spec.basic.float$ = octet.spec.basic.primitive_spec.call(null,(4),octet.buffer.read_float,octet.buffer.write_float);
/**
 * Double type spec.
 */
octet.spec.basic.double$ = octet.spec.basic.primitive_spec.call(null,(8),octet.buffer.read_double,octet.buffer.write_double);
/**
 * Fixed size byte array type spec constructor.
 */
octet.spec.basic.bytes = (function octet$spec$basic$bytes(size){
if((typeof octet !== 'undefined') && (typeof octet.spec !== 'undefined') && (typeof octet.spec.basic !== 'undefined') && (typeof octet.spec.basic.t_octet$spec$basic27526 !== 'undefined')){
} else {

/**
* @constructor
 * @implements {octet.spec.ISpec}
 * @implements {cljs.core.IMeta}
 * @implements {cljs.core.IWithMeta}
 * @implements {octet.spec.ISpecSize}
*/
octet.spec.basic.t_octet$spec$basic27526 = (function (size,meta27527){
this.size = size;
this.meta27527 = meta27527;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
octet.spec.basic.t_octet$spec$basic27526.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27528,meta27527__$1){
var self__ = this;
var _27528__$1 = this;
return (new octet.spec.basic.t_octet$spec$basic27526(self__.size,meta27527__$1));
});

octet.spec.basic.t_octet$spec$basic27526.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27528){
var self__ = this;
var _27528__$1 = this;
return self__.meta27527;
});

octet.spec.basic.t_octet$spec$basic27526.prototype.octet$spec$ISpecSize$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27526.prototype.octet$spec$ISpecSize$size$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.size;
});

octet.spec.basic.t_octet$spec$basic27526.prototype.octet$spec$ISpec$ = cljs.core.PROTOCOL_SENTINEL;

octet.spec.basic.t_octet$spec$basic27526.prototype.octet$spec$ISpec$read$arity$3 = (function (_,buff,pos){
var self__ = this;
var ___$1 = this;
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [self__.size,octet.buffer.read_bytes.call(null,buff,pos,self__.size)], null);
});

octet.spec.basic.t_octet$spec$basic27526.prototype.octet$spec$ISpec$write$arity$4 = (function (_,buff,pos,value){
var self__ = this;
var ___$1 = this;
octet.buffer.write_bytes.call(null,buff,pos,self__.size,value);

return self__.size;
});

octet.spec.basic.t_octet$spec$basic27526.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"size","size",-1555742762,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"long","long",1469079434,null)], null)),new cljs.core.Symbol(null,"meta27527","meta27527",-1648243439,null)], null);
});

octet.spec.basic.t_octet$spec$basic27526.cljs$lang$type = true;

octet.spec.basic.t_octet$spec$basic27526.cljs$lang$ctorStr = "octet.spec.basic/t_octet$spec$basic27526";

octet.spec.basic.t_octet$spec$basic27526.cljs$lang$ctorPrWriter = (function (this__4374__auto__,writer__4375__auto__,opt__4376__auto__){
return cljs.core._write.call(null,writer__4375__auto__,"octet.spec.basic/t_octet$spec$basic27526");
});

/**
 * Positional factory function for octet.spec.basic/t_octet$spec$basic27526.
 */
octet.spec.basic.__GT_t_octet$spec$basic27526 = (function octet$spec$basic$bytes_$___GT_t_octet$spec$basic27526(size__$1,meta27527){
return (new octet.spec.basic.t_octet$spec$basic27526(size__$1,meta27527));
});

}

return (new octet.spec.basic.t_octet$spec$basic27526(size,cljs.core.PersistentArrayMap.EMPTY));
});
/**
 * Unsinged int16 type spec.
 */
octet.spec.basic.uint16 = octet.spec.basic.primitive_spec.call(null,(2),octet.buffer.read_ushort,octet.buffer.write_ushort);
/**
 * Unsinged int32 type spec.
 */
octet.spec.basic.uint32 = octet.spec.basic.primitive_spec.call(null,(4),octet.buffer.read_uint,octet.buffer.write_uint);
/**
 * Unsinged byte type spec.
 */
octet.spec.basic.ubyte = octet.spec.basic.primitive_spec.call(null,(1),octet.buffer.read_ubyte,octet.buffer.write_ubyte);
/**
 * Unsinged int64 type spec.
 */
octet.spec.basic.uint64 = octet.spec.basic.primitive_spec.call(null,(8),octet.buffer.read_ulong,octet.buffer.write_ulong);
